Repository navigation
fix(auth)!: stop handing signed storage URLs to unverified tokens - #309
Merged
Merged
Conversation
…ut it - refuse ENABLE_DIRECT_DOWNLOADS=true with SKIP_TOKEN_VALIDATION=true unless UNSAFE_ALLOW_DIRECT_DOWNLOADS_WITHOUT_TOKEN_VALIDATION=true - require `exp` on verified tokens; optional ACTIONS_TOKEN_AUDIENCE - treat scope permissions as read/write bit flags and reject malformed scopes - log only the token error kind and claim name - DIRECT_DOWNLOAD_URL_TTL_SECONDS (default 600); the reader lease outlives the URL by a fixed margin BREAKING CHANGE: setups running ENABLE_DIRECT_DOWNLOADS=true together with SKIP_TOKEN_VALIDATION=true no longer start. Closes #298 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
A direct-download URL is a bearer credential for the stored object, and the runtime token is the only thing guarding it. With
SKIP_TOKEN_VALIDATION=truethe token's claims are trusted unverified, so anyone who can reach the server could get a signed URL for any repository's cache. Verified tokens had gaps too: a token withoutexpnever expired, a write-only scope was used for reads, and the debug log printed decoded claims.This PR ports the intent of @chenrui333's branch from #294 to the Rust server:
The lease now outlives the URL because storage authenticates a GET when it starts, so a transfer that starts just before the URL expires keeps reading after it. Recorded in the new ADR-0013 and an updated ADR-0002. The Helm chart exposes
config.directDownloadUrlTtlSeconds.✅ Verification
exp, a token with"Permission": -1, or a write-only scope used for lookups were all accepted. Direct downloads started fine withSKIP_TOKEN_VALIDATION=true.After: new tests check that each of these is now rejected, using tokens signed with a test Ed25519 key and a JWKS served by the test:
scope::tests::verified_tokens_need_exp_and_well_formed_scopesscope::tests::a_configured_audience_is_requiredscope::tests::permissions_are_bit_flagsconfig::tests::direct_downloads_require_token_validationconfig::tests::bounds_the_direct_download_url_lifetimeconfig::tests::parses_the_token_audiencetests::downloads::a_direct_download_lease_outlives_the_signed_url(S3):X-Amz-Expiresequals the configured TTL, and the lease lasts at least TTL + 10 min.cargo +nightly fmt --check,cargo clippy --all-targets --locked: cleancargo teston sqlite × filesystem and sqlite × s3: 82 passedhelm templaterendersDIRECT_DOWNLOAD_URL_TTL_SECONDS: "600"🔍 Reviews
ACTIONS_TOKEN_AUDIENCEis not exposed in the Helm chart. The chart doesn't expose the issuer orSKIP_TOKEN_VALIDATIONeither; useextraEnvto set it.🔗 Issues
Closes #298
💥 Merge danger
Door: two-way
Reverting restores the old behavior. No data or schema changes.
Blast Radius: startup
Deployments that run
ENABLE_DIRECT_DOWNLOADS=truetogether withSKIP_TOKEN_VALIDATION=truestop at startup and need a release note. Tokens withoutexpor with a malformedacclaim are now rejected; GitHub-issued tokens always carry well-formed ones.DIRECT_DOWNLOAD_URL_TTL_SECONDS,ACTIONS_TOKEN_AUDIENCEandUNSAFE_ALLOW_DIRECT_DOWNLOADS_WITHOUT_TOKEN_VALIDATIONin falcondev-oss/docs.🤖 Generated with Claude Code