Documentation
¶
Index ¶
- Constants
- func CreateAttestationResolver(resolver oci.ImageDetailsResolver, policyMapping *mapping.PolicyMapping) (attestation.Resolver, error)
- func CreateImageDetailsResolver(imageSource *oci.ImageSpec) (oci.ImageDetailsResolver, error)
- func RegoFunctions(regoOpts *RegoFnOpts) []*tester.Builtin
- func VerifySubject(ctx context.Context, subject []intoto.Subject, resolver attestation.Resolver) error
- type Evaluator
- type File
- type Input
- type MockPolicyEvaluator
- type Options
- type Parameters
- type Policy
- type RegoFnOpts
- type Resolver
- type Result
- type Summary
- type Violation
Constants ¶
View Source
const (
DefaultQuery = "result := data.attest.result"
)
Variables ¶
This section is empty.
Functions ¶
func CreateAttestationResolver ¶
func CreateAttestationResolver(resolver oci.ImageDetailsResolver, policyMapping *mapping.PolicyMapping) (attestation.Resolver, error)
func CreateImageDetailsResolver ¶
func CreateImageDetailsResolver(imageSource *oci.ImageSpec) (oci.ImageDetailsResolver, error)
func RegoFunctions ¶
func RegoFunctions(regoOpts *RegoFnOpts) []*tester.Builtin
func VerifySubject ¶
func VerifySubject(ctx context.Context, subject []intoto.Subject, resolver attestation.Resolver) error
VerifySubject verifies if any of the given subject PURLs matches the image name and platform from resolver. Tags are not taken into account when attempting to match because sometimes the user may not have specified a tag, and maybe there isn't a purl subject with that particular tag (because of post build tagging?).
Types ¶
type Evaluator ¶
type Evaluator interface {
Evaluate(ctx context.Context, resolver attestation.Resolver, pctx *Policy, input *Input) (*Result, error)
}
func GetMockPolicy ¶
func GetMockPolicy() Evaluator
func NewRegoEvaluator ¶
func NewRegoEvaluator(debug bool, attestationVerifier attestation.Verifier) Evaluator
type Input ¶
type Input struct { Digest string `json:"digest"` PURL string `json:"purl"` Tag string `json:"tag,omitempty"` Domain string `json:"domain"` NormalizedName string `json:"normalized_name"` FamiliarName string `json:"familiar_name"` Platform string `json:"platform"` Parameters Parameters `json:"parameters"` }
type MockPolicyEvaluator ¶
type Options ¶
type Options struct { TUFClientOptions *tuf.ClientOptions DisableTUF bool LocalTargetsDir string LocalPolicyDir string PolicyID string ReferrersRepo string AttestationStyle mapping.AttestationStyle Debug bool AttestationVerifier attestation.Verifier // extra parameters to pass through to rego as policy inputs Parameters Parameters }
type Parameters ¶ added in v0.6.6
type RegoFnOpts ¶ added in v0.6.0
type RegoFnOpts struct {
// contains filtered or unexported fields
}
func NewRegoFunctionOptions ¶ added in v0.6.0
func NewRegoFunctionOptions(resolver attestation.Resolver, verifier attestation.Verifier) *RegoFnOpts
this is exported for testing here and in clients of the library.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(tufClient tuf.Downloader, opts *Options) *Resolver
type Result ¶
type Result struct { Success bool `json:"success"` Violations []Violation `json:"violations"` Summary Summary `json:"summary"` }
func AllowedResult ¶
func AllowedResult() *Result
type Summary ¶
type Summary struct { Subjects []intoto.Subject `json:"subjects"` Inputs []attestation.ResourceDescriptor `json:"input_attestations"` SLSALevels []string `json:"slsa_levels"` Verifier string `json:"verifier"` PolicyURI string `json:"policy_uri"` }
Click to show internal directories.
Click to hide internal directories.