Documentation
¶
Overview ¶
Package attest is the public attestation format for published versions: the in-toto v1 statement, the publish predicate, the DSSE envelope, and offline verification. It is what the CLI — and any third-party client — needs to verify a release against the registry's well-known signing keys; producing signatures stays server-side.
Index ¶
- Constants
- func KeyIDFor(pub *ecdsa.PublicKey) string
- func PAE(payloadType string, payload []byte) []byte
- func VerifyPayload(env DSSEEnvelope, publicKeyPEM, payloadType string) ([]byte, error)
- type DSSEEnvelope
- type DSSESignature
- type InTotoStatement
- type PublishPredicate
- type RulesetPredicate
- type ScanRunRef
- type Subject
Constants ¶
const PayloadType = "application/vnd.in-toto+json"
PayloadType is the DSSE payload type for in-toto statements.
const PredicateType = "https://agentry.dev/attestation/publish/v1"
PredicateType is the Agentry publish attestation predicate.
const RulesetPredicateType = "https://agentry.dev/attestation/ruleset/v1"
RulesetPredicateType is the rule-bundle attestation predicate: the registry signs the bundle `validate --rules-update` serves, with the same key that signs releases, so a client pins by signature and not only by the digest the same server advertised.
Variables ¶
This section is empty.
Functions ¶
func VerifyPayload ¶ added in v0.7.9
func VerifyPayload(env DSSEEnvelope, publicKeyPEM, payloadType string) ([]byte, error)
VerifyPayload checks a DSSE envelope of the given payload type against a PEM public key and returns the signed payload. The same key may sign more than one kind of payload, so the type is checked before anything else: the signature covers it, and an envelope of another type is refused rather than decoded as this one. The key rule is VerifyEnvelope's: the caller chooses the key, never the envelope.
Types ¶
type DSSEEnvelope ¶
type DSSEEnvelope struct {
PayloadType string `json:"payloadType"`
Payload string `json:"payload"` // base64 of the statement
Signatures []DSSESignature `json:"signatures"`
}
DSSEEnvelope is the signed wrapper (dsse v1).
type DSSESignature ¶
DSSESignature is one signature over the PAE-encoded payload.
type InTotoStatement ¶
type InTotoStatement struct {
Type string `json:"_type"`
Subject []Subject `json:"subject"`
PredicateType string `json:"predicateType"`
Predicate interface{} `json:"predicate"`
}
InTotoStatement is the signed subject (in-toto v1).
func BuildRulesetStatement ¶
func BuildRulesetStatement(registry, semver, bundleDigest string) InTotoStatement
BuildRulesetStatement assembles the in-toto statement for a rule bundle: subject "ruleset" with the bundle's content digest.
func BuildStatement ¶
func BuildStatement(registry, agentPath, version, archiveDigest, commitSHA, source string, run ScanRunRef, policyVersion int) InTotoStatement
BuildStatement assembles the in-toto statement for a published version.
func VerifyEnvelope ¶
func VerifyEnvelope(env DSSEEnvelope, publicKeyPEM string) (InTotoStatement, error)
VerifyEnvelope checks a DSSE envelope of an in-toto statement against a PEM public key; an envelope of any other payload type is refused. Used by the CLI (offline), the server's own tests, and third-party verifiers.
The caller chooses the key. A signature's keyid is a label the signer attached, not evidence of anything: it is never read here, and a verifier must never resolve a key from it (fetching or selecting whatever key an envelope names would let the envelope's author pick the key that checks it). The key comes from a source the verifier already trusts.
type PublishPredicate ¶
type PublishPredicate struct {
Registry string `json:"registry"`
Agent string `json:"agent"`
Version string `json:"version"`
CommitSHA string `json:"commitSha,omitempty"`
Source string `json:"source"`
ScanRun ScanRunRef `json:"scanRun"`
PolicyVer int `json:"policyVersion"`
PublishedAt string `json:"publishedAt"`
}
PublishPredicate is the publish predicate.
type RulesetPredicate ¶
type RulesetPredicate struct {
Registry string `json:"registry"`
Semver string `json:"semver"`
SignedAt string `json:"signedAt"`
}
RulesetPredicate describes the signed bundle.