Repository navigation
fix(site): skip the releases lookup when no GITHUB_TOKEN is present - #52
Merged
Merged
Conversation
The latest.json route authenticated only when GITHUB_TOKEN was set, and ci.yml's build step passes no environment, so the build-time call to api.github.com went out anonymous. The anonymous budget is 60 requests per hour per IP and GitHub-hosted runners share egress IPs across every Actions customer, so the budget is usually spent by strangers before we arrive: any CI run could fail with an error that reads like a release problem. It cost a full re-run of an 8-minute job on #36. Return the existing empty-body 404 before the network when no token is present. That is not a relaxation of fail-closed -- emitting no latest.json is what the rest of the module already does when it cannot prove an artifact -- and nothing in this repository deploys a manifest from here: .github/workflows/ holds only ci.yml and release.yml, and the manifest mxml.sh serves is deployed from stuffbucket/maximal. The alternative, passing GITHUB_TOKEN in ci.yml, would put a token in the environment of a build that executes arbitrary dependency code, against the producer isolation the release pipeline is built on. Also drops the docstring's reference to deploy-pages.yml, which does not exist in this repository. Closes #47
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.
Fixes the random CI failure filed as #47.
The problem
packages/maximal/site/src/pages/updates/latest.json.tscalls the GitHubreleases API at build time and authenticates only when
GITHUB_TOKENis set.ci.yml's build step passes no environment, so the request went out anonymous.Anonymous GitHub API is 60 requests/hour per IP, and GitHub-hosted runners
share egress IPs across every Actions customer, so the budget is usually spent
by strangers before we arrive. This was never our own usage approaching a
limit: one call per build could not reach the 1,000/hour/repo authenticated
limit. Any run could fail with an error that reads like a release problem, and
one did on #36.
The fix
Option 1 from the issue.
GETreturns the existing empty-body 404 — the same"write no
latest.json" outcome the module already produces when it cannotprove an artifact — before the network, when no token is present.
This is not a relaxation of fail-closed. Where a token is supplied and a
manifest is actually deployed,
fetchLatestRelease/fetchSignature/buildUpdaterManifestbehave exactly as before. And nothing deploys a manifestfrom this repository:
.github/workflows/holds onlyci.ymlandrelease.yml, and the manifest mxml.sh serves is deployed fromstuffbucket/maximal.Option 2 (pass
GITHUB_TOKENinci.yml) is one line, but puts a token in theenvironment of a build that executes arbitrary dependency code — the opposite
of the producer-isolation stance the release pipeline is built on.
Also drops the
githubHeadersdocstring's reference todeploy-pages.yml,which does not exist in this repository.
Verification
astro buildwithGITHUB_TOKENunset:/updates/latest.json (+1ms) (file not created, response body was empty)— no file written, and the +1ms showsno network call was made.
verify-dist.mjspasses.canFetchUpdaterReleasecases covering unset, empty, and whitespace-onlytokens.
Closes #47