How github/artifact-attestations-opa-provider works
This is a Gatekeeper ExternalData provider that retrieves and cryptographically verifies container-image attestations so Gatekeeper policies can evaluate them during admission. The main flow is admission request → TLS provider → registry authentication and bundle retrieval → Sigstore verification → attestations returned to Gatekeeper for Rego evaluation and a policy decision. Supporting branches include trust-root configuration, certificate injection, metrics, and the documented example policies. Some subsystem links are based on README descriptions because their implementation was not sampled.
Main entry points: provider.go ExternalData handler · aaop.go Provider server · multi.go Trust-root selection · bundle.go Bundle fetcher
Components 18
Provider runtime
- Provider server
cmd/aaop/aaop.go - ExternalData handler
pkg/provider/provider.go - CA bundle injection
pkg/cainjector/injector.go
Attestation retrieval
- Registry keychain
pkg/authn/provider.go - Bundle fetcher
pkg/fetcher/bundle.go - Fetch tracing
pkg/fetcher/trace.go
Trust and verification
- Verifier configuration
internal/app/verifier.go - Trust-root selection
pkg/verifier/multi.go - Bundle verification
pkg/verifier/verifier.go
Policy and operations
- Prometheus metrics
pkg/metrics/prom.go - Example Gatekeeper policies
rego/policies.rego - Organization constraints
validation/from-org-constraint-template.yaml - Repository constraints
validation/from-repo-constraint-template.yaml - Signer constraints
validation/from-org-with-signer-constraint-template.yaml
Other components
- Kubernetes admission
- OPA Gatekeeper
- OCI registry
- Sigstore TUF services
Connections 20
- Kubernetes admission → OPA Gatekeeper: requests admission
README.md - OPA Gatekeeper → Provider server: requests image data
README.md - Provider server → ExternalData handler: routes requests
cmd/aaop/aaop.go - Provider server → Verifier configuration: creates verifier
cmd/aaop/aaop.go - Provider server → Registry keychain: starts keychain
cmd/aaop/aaop.go - ExternalData handler → Registry keychain: gets credentials
pkg/provider/provider.go - ExternalData handler → Bundle fetcher: fetches bundles
pkg/provider/provider.go - Bundle fetcher → OCI registry: retrieves attestations
README.md - ExternalData handler → Trust-root selection: verifies bundles
pkg/provider/provider.go - Verifier configuration → Trust-root selection: assembles verifiers
internal/app/verifier.go - Trust-root selection → Bundle verification: tries trust roots
pkg/verifier/multi.go - Bundle verification → Sigstore TUF services: loads trust roots
README.md - ExternalData handler → OPA Gatekeeper: returns attestations
README.md - OPA Gatekeeper → Example Gatekeeper policies: evaluates policies
README.md - OPA Gatekeeper → Kubernetes admission: returns decision
README.md - ExternalData handler → Prometheus metrics: records metrics
pkg/provider/provider.go - Provider server → CA bundle injection: may initialize
- Organization constraints → OPA Gatekeeper: configures policy
README.md - Repository constraints → OPA Gatekeeper: configures policy
README.md - Signer constraints → OPA Gatekeeper: configures policy
README.md