feat(slsa): add RequireAttestation configuration for strict SLSA verification #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for
LEEWAY_SLSA_REQUIRE_ATTESTATIONenvironment variable and--slsa-require-attestationCLI flag to control behavior when SLSA attestations are missing or invalid.Problem
When attestations from one PR fail verification in another PR (e.g., due to source URI mismatches like
refs/pull/11265/mergevsrefs/pull/11279/merge), the current behavior downloads artifacts without verification. This creates a security gap where unverified artifacts are used without being re-signed with the correct attestation.Fixes https://linear.app/ona-team/issue/CLC-2053/mechanism-to-control-behavior-when-slsa-attestations-are-missing-or
Solution
Add
RequireAttestationconfiguration that enables two verification modes:Permissive Mode (RequireAttestation=false, default)
Strict Mode (RequireAttestation=true)
provenance.slsa=truein WORKSPACE.yamlChanges
Configuration (Commit 1)
EnvvarSLSARequireAttestationconstant tocmd/root.goandpkg/leeway/workspace.go--slsa-require-attestationflag to build commandparseSLSAConfig()to read and apply RequireAttestation settingApplySLSADefaults()to auto-enable RequireAttestation with SLSA L3pkg/leeway/cache/types.gopkg/leeway/cache/remote/s3.goNote: The actual RequireAttestation logic in
downloadWithSLSAVerification()was already implemented; this PR adds the configuration mechanism.Tests (Commit 2)
TestBuildCommandFlagswith 3 test cases for--slsa-require-attestationflagTestParseSLSAConfigwith 6 test cases for configuration parsing logicDocumentation (Commit 3)
LEEWAY_SLSA_REQUIRE_ATTESTATIONto CLI help textUsage
Via Environment Variable
Via CLI Flag
Automatic (Workspace Config)
Testing
All tests pass:
Implementation Notes
S3Cache.downloadWithSLSAVerification()(line 484)s3_slsa_test.goands3_resilience_test.goalready verify the behavior