Documentation
¶
Overview ¶
Package predicate registers SLSA-only attestation.PredicateParser implementations as the collector's global predicate parser registry.
Importing this package replaces github.com/carabiner-dev/collector's shipped predicate parser map (which covers SBOMs, VEX, OSV, …) with the SLSA build (v0.1, v0.2, v1.0) and SLSA source predicate types only, using the upstream proto definitions from github.com/in-toto/attestation/go/predicates/provenance and github.com/slsa-framework/source-tool/pkg/provenance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Parsers = func() collectorpred.ParsersList { out := collectorpred.ParsersList{} for _, pt := range eval.KnownPredicateTypes() { p, _ := NewParser(attestation.PredicateType(pt)) out[attestation.PredicateType(pt)] = p } return out }()
Parsers is the SLSA-only predicate parser registry — one Parser per predicate type known to the eval package.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser handles a single SLSA predicate type by unmarshalling JSON into the upstream proto message registered for that type in the eval package.
func NewParser ¶
func NewParser(predicateType attestation.PredicateType) (*Parser, bool)
NewParser returns a Parser for the given SLSA predicate type. The type must be registered in the eval package; otherwise NewParser returns nil and false.
func (*Parser) Parse ¶
func (p *Parser) Parse(data []byte) (attestation.Predicate, error)
Parse unmarshals data into the proto message backing this parser's predicate type and wraps it in a generic.Predicate so the collector can thread it through statements and envelopes. After unmarshalling, nil singular sub-messages are replaced with zero-valued instances so CEL expressions can chain through intermediate fields without erroring on missing payload data.
func (*Parser) SupportsType ¶
func (p *Parser) SupportsType(types ...attestation.PredicateType) bool
SupportsType reports whether this parser handles any of types.