Documentation
¶
Index ¶
- Constants
- Variables
- func ExactTagForBuildVersion(buildVersion string) (string, error)
- type Asset
- type Attestation
- type AttestationInput
- type AttestationVerifier
- type Blob
- type Channel
- type FixtureSource
- func (source *FixtureSource) AddRelease(index Index, prerelease bool, publishedAt time.Time) error
- func (source *FixtureSource) Fetch(_ context.Context, url string, limit int64) ([]byte, error)
- func (source *FixtureSource) ListReleases(context.Context) ([]Release, error)
- func (source *FixtureSource) SetBlob(url string, data []byte)
- type GitHubSource
- type Index
- type IndexAttestationInput
- type Installer
- func (installer Installer) InspectInstalled(ctx context.Context, installDir string, ...) error
- func (installer Installer) InspectVerifiedArchive(ctx context.Context, resolution Resolution, ...) error
- func (installer Installer) Install(ctx context.Context, resolution Resolution, workspaceRoot string) (Receipt, error)
- func (installer Installer) VerifyInstalled(ctx context.Context, installDir string) (Receipt, error)
- func (installer Installer) VerifyWorkspace(ctx context.Context, workspaceRoot, kit string, platform Platform) ([]Receipt, error)
- type Platform
- type Receipt
- type Release
- type ReleaseDescriptor
- type Resolution
- type ResolveRequest
- type Resolver
- type SigstoreVerifier
- type Source
- type VerifiedArchive
- type VerifiedInstallation
Constants ¶
const ( SchemaVersion = "stackkits-release-index/v1" ReceiptSchemaVersion = "stackkit.release-receipt/v1" ReleaseIndexAssetName = "stackkits-release-index-v1.json" ReleaseIndexAttestationAssetName = "stackkits-release-index-v1.json.intoto.jsonl" TrustedRootAssetName = "sigstore-trusted-root.jsonl" ReleaseReceiptName = "release-receipt.json" SPDXJSONMediaType = "application/spdx+json" InTotoJSONLMediaType = "application/vnd.in-toto+jsonl" GitHubOIDCIssuer = "https://token.actions.githubusercontent.com" GitHubAttestationPredicate = "https://slsa.dev/provenance/v1" SigstoreTrustedRootMediaType = "application/vnd.dev.sigstore.trustedroot+json;version=0.1" DefaultMaxBlobBytes int64 = 4 << 30 )
Variables ¶
var ( ErrDigestMismatch = errors.New("release blob digest mismatch") ErrNoRelease = errors.New("no matching StackKits release") )
Functions ¶
func ExactTagForBuildVersion ¶
ExactTagForBuildVersion converts the release build value embedded by GoReleaser into the one exact GitHub tag that publishes it.
Types ¶
type Attestation ¶
type AttestationInput ¶
type AttestationVerifier ¶
type AttestationVerifier interface {
Verify(context.Context, AttestationInput) error
VerifyIndex(context.Context, IndexAttestationInput) error
}
type FixtureSource ¶
type FixtureSource struct {
// contains filtered or unexported fields
}
FixtureSource is a hermetic in-memory release source for contract and OSS E2E tests. Product code depends only on Source; it never branches on fixture mode.
func NewFixtureSource ¶
func NewFixtureSource() *FixtureSource
func (*FixtureSource) AddRelease ¶
func (*FixtureSource) ListReleases ¶
func (source *FixtureSource) ListReleases(context.Context) ([]Release, error)
func (*FixtureSource) SetBlob ¶
func (source *FixtureSource) SetBlob(url string, data []byte)
type GitHubSource ¶
func NewGitHubFixtureSource ¶
func NewGitHubFixtureSource(client *http.Client, apiBaseURL string) (*GitHubSource, error)
NewGitHubFixtureSource creates the hermetic HTTP adapter used by the standalone OSS E2E. It deliberately accepts only loopback and the reserved .localhost namespace; public release URLs retain the GitHub-only policy.
func NewGitHubSource ¶
func NewGitHubSource(client *http.Client) *GitHubSource
func (*GitHubSource) ListReleases ¶
func (source *GitHubSource) ListReleases(ctx context.Context) ([]Release, error)
type Index ¶
type Index struct {
SchemaVersion string `json:"schemaVersion"`
Release ReleaseDescriptor `json:"release"`
Assets []Asset `json:"assets"`
}
type IndexAttestationInput ¶
type Installer ¶
type Installer struct {
Source Source
Attestations AttestationVerifier
MaxBlobBytes int64
Now func() time.Time
}
func (Installer) InspectInstalled ¶
func (installer Installer) InspectInstalled( ctx context.Context, installDir string, inspect func(VerifiedInstallation) error, ) error
InspectInstalled re-verifies an installed release and returns an immutable proof containing the exact bounded archive bytes verified in this operation.
func (Installer) InspectVerifiedArchive ¶
func (installer Installer) InspectVerifiedArchive(ctx context.Context, resolution Resolution, inspect func(VerifiedArchive) error) error
InspectVerifiedArchive downloads and verifies one resolved release in a process-owned temporary directory without installing or caching anything in the Stack workspace. The callback cannot retain the paths after it returns.
func (Installer) VerifyInstalled ¶
func (Installer) VerifyWorkspace ¶
func (installer Installer) VerifyWorkspace(ctx context.Context, workspaceRoot, kit string, platform Platform) ([]Receipt, error)
VerifyWorkspace re-verifies every cached release receipt for one kit and platform without consulting the release source or making network requests.
type Receipt ¶
type Receipt struct {
SchemaVersion string `json:"schemaVersion"`
Kit string `json:"kit"`
Version string `json:"version"`
Channel Channel `json:"channel"`
Platform Platform `json:"platform"`
ArchiveSHA256 string `json:"archiveSha256"`
SBOMSHA256 string `json:"sbomSha256"`
AttestationSHA256 string `json:"attestationSha256"`
AttestationIssuer string `json:"attestationIssuer"`
AttestationSubject string `json:"attestationSubject"`
TrustedRootSHA256 string `json:"trustedRootSha256"`
IndexSHA256 string `json:"indexSha256"`
IndexAttestationSHA256 string `json:"indexAttestationSha256"`
VerifiedAt time.Time `json:"verifiedAt"`
InstallDir string `json:"installDir"`
}
type ReleaseDescriptor ¶
type Resolution ¶
type Resolver ¶
type Resolver struct {
Source Source
Attestations AttestationVerifier
}
func (Resolver) Resolve ¶
func (resolver Resolver) Resolve(ctx context.Context, request ResolveRequest) (Resolution, error)
type SigstoreVerifier ¶
type SigstoreVerifier struct {
// contains filtered or unexported fields
}
SigstoreVerifier verifies a cached GitHub artifact-attestation bundle against the exact cached trusted root, archive digest, GitHub OIDC issuer, workflow identity, predicate type, and subject name declared by the release index. It performs no network requests.
trustedRootDocumentSHA256 exists for same-package hermetic tests. Production callers cannot set it and are bound to the versioned policy embedded in the binary.
func (SigstoreVerifier) Verify ¶
func (verifier SigstoreVerifier) Verify(ctx context.Context, input AttestationInput) error
func (SigstoreVerifier) VerifyIndex ¶
func (verifier SigstoreVerifier) VerifyIndex(ctx context.Context, input IndexAttestationInput) error
type VerifiedArchive ¶
type VerifiedArchive struct {
ArchivePath string
SBOMPath string
AttestationPath string
TrustedRootPath string
}
VerifiedArchive is a short-lived, fully verified release payload. Paths are valid only for the duration of InspectVerifiedArchive's callback.
type VerifiedInstallation ¶
type VerifiedInstallation struct {
// contains filtered or unexported fields
}
VerifiedInstallation is an immutable proof of one offline-verified cached release. Its private token and fields make the zero value invalid and prevent another package from fabricating or mutating release authority.