Documentation
¶
Overview ¶
Package p2 validates Eclipse p2 update-site paths and bounded metadata.
Index ¶
- Constants
- Variables
- func ArtifactChecksums(metadataName string, body []byte, artifactPath string) (types.Checksums, error)
- func EditComposite(name string, body []byte, replace func(string) (string, error)) ([]byte, error)
- func ExtractArchive(site []byte, entry string) ([]byte, error)
- func ValidChildLocation(raw string) bool
- func Validate(name string, src io.ReadSeeker, size int64) error
- type Kind
Constants ¶
const ( MaxMetadata = 36 << 20 MaxArtifact = 512 << 20 MaxChildren = 64 MaxDepth = 5 MaxChildURL = 2048 )
Variables ¶
var ErrInvalid = errors.New("p2: invalid p2 repository content")
Functions ¶
func ArtifactChecksums ¶
func ArtifactChecksums( metadataName string, body []byte, artifactPath string, ) (types.Checksums, error)
ArtifactChecksums reads the checksums declared for a standard P2 artifact path. An absent declaration leaves the structural JAR validation in force. Invalid declarations fail closed instead of silently disabling pinning.
func EditComposite ¶
EditComposite reads any supported composite metadata representation, calls replace for each child location, and returns its complete rewritten bytes. No original location reaches a client if one replacement fails.
func ExtractArchive ¶
ExtractArchive serves Artifactory's `site.zip!/` P2 URL form. The complete source archive is checked before its named update-site file is delivered.
func ValidChildLocation ¶
ValidChildLocation accepts repository-relative locations and absolute HTTP(S) locations. The server separately checks configured origin policy before any child is exposed. This syntax check also rejects encoded traversal.