Repository navigation
feat(cache): authenticate remote cache uploads with GitHub Actions OIDC - #798
Merged
wan9chi merged 2 commits intoOct 5, 2026
Conversation
wan9chi
force-pushed
the
claude/github-oidc-auth-headers-18e511
branch
from
October 4, 2026 07:52
3f44ec4 to
64b0977
Compare
fspy benchmarklinuxmacoswindows |
wan9chi
force-pushed
the
claude/github-oidc-auth-headers-18e511
branch
2 times, most recently
from
October 4, 2026 12:42
e00a71b to
0c99de0
Compare
wan9chi
force-pushed
the
claude/github-oidc-auth-headers-18e511
branch
2 times, most recently
from
October 5, 2026 00:51
86869ae to
9c13e94
Compare
wan9chi
force-pushed
the
claude/github-oidc-auth-headers-18e511
branch
from
October 5, 2026 01:00
9c13e94 to
c724b54
Compare
wan9chi
marked this pull request as ready for review
October 5, 2026 01:01
Planning resolves `ResolvedRemoteCacheConfig::auth` to `github-oidc` when `ACTIONS_ID_TOKEN_REQUEST_URL` and `ACTIONS_ID_TOKEN_REQUEST_TOKEN` are set. It holds the request URL, the request token, and the audience, which is the endpoint without a trailing slash. The request token is a `Secret`, which debug output and serialized plans redact. `build_auth` turns it into `vt_remote_cache::auth::GithubOidc`, which adds a GitHub Actions OIDC token to stores only. It requests a token when the first store needs it, reuses it until two minutes before it expires, shares one request between concurrent stores, and remembers a failed request, so later stores fail without another one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`GithubOidc` keeps its state in one enum, so a token can't stay cached after a failure, and invalid settings start out failed. A token without an `exp` claim is now a malformed response, rather than being used once: the server rejects such tokens anyway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wan9chi
force-pushed
the
claude/github-oidc-auth-headers-18e511
branch
from
October 5, 2026 02:09
c724b54 to
238a29c
Compare
This was referenced Oct 5, 2026
wan9chi
added a commit
that referenced
this pull request
Nov 7, 2026
…ons stand-in (#809) ## Motivation [Vite+'s Cloudflare remote cache](https://github.com/voidzero-dev/vite-plus-remote-cache-cloudflare) only accepts uploads with a GitHub Actions OIDC token. The token has to come from a push to the registered repository's main branch, and its audience has to be the endpoint. The file backend accepted any upload, so the e2e cases never sent a token and never exercised the client's OIDC support from #798. ## Changes - **GitHub Actions stand-in.** The backend process stands in for GitHub's token service. `remote-cache-server run --github-actions` runs a command as if in a job with `id-token: write`: it sets `ACTIONS_ID_TOKEN_REQUEST_URL`, and `ACTIONS_ID_TOKEN_REQUEST_TOKEN` defaults to `main-push`. The request token picks the workflow run the token is for: `main-push` or `pull-request`. - **Write policy.** Like the Worker, the file backend checks each store's token: its RS256 signature against the stand-in's key, its time bounds, its audience, and its claims. It answers other stores as the Worker does, with `401 Invalid credentials` or `403 Write not permitted`. - **Uploading steps** run with `--github-actions`. The only snapshot changes are those command lines. Stacked on #808. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Changes are limited to test tooling (`remote-cache-server`) and e2e fixtures; production cache client code is only invoked more realistically in tests. > > **Overview** > Aligns the **remote-cache test backend** with production by requiring a **GitHub Actions OIDC token** on `POST /store` (401/403 otherwise), while **fetch/read stays unauthenticated**. > > A new **`--github-actions`** flag on `remote-cache-server run` simulates a job with `id-token: write` (`ACTIONS_ID_TOKEN_REQUEST_URL` / default `main-push` request token). The daemon’s control server exposes a **`/token`** endpoint that mints RS256 JWTs; **`backend.ts`** verifies signature, time bounds, audience (endpoint), and push-to-`main` claims before accepting stores. E2E **upload steps** and snapshot command lines now pass **`--github-actions`** so tests exercise the client OIDC path. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a31b6bf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Motivation
The self-hosted remote cache server in #718, designed in #716, accepts uploads only with a GitHub Actions OIDC token. The token's audience must be the namespace endpoint, and it must come from a push job on the main branch.
vp runsends stores without credentials today, so that server rejects every upload with 401.Changes
remote_cache.authtogithub-oidcwhenACTIONS_ID_TOKEN_REQUEST_URLandACTIONS_ID_TOKEN_REQUEST_TOKENare set in the envs visible at thevp runlevel. That happens in jobs withpermissions: id-token: write; otherwise the auth staysanonymous.Secret, which debug output and serialized plans redact.build_authturnsgithub-oidcintovt_remote_cache::auth::GithubOidc, which addsAuthorization: Bearer <token>to stores only. Fetches and downloads stay anonymous.exp. Cloudflare receives a store's whole body before the Worker checks the token, so the token has to outlast the upload. A token withoutexpis a malformed response.vp runkeeps working.Stacked on #797, which adds the
Authhook and the resolved auth config.🤖 Generated with Claude Code