Repository navigation
ci: rebuild the security watch when the advisory record changes - #36
Merged
Merged
Conversation
The watch at tetrak.dev/security/ is built from docs/advisories/record.json, fetched from main at build time, and until now a change to the record only reached the site on the Monday rebuild or when someone pushed to the site's own repository. A push to main that changes record.json now asks Cloudflare for a build through a deploy hook, so a merged triage is published in about ten minutes and whoever merged it needs no access to the site. The job waits five minutes first: raw.githubusercontent.com serves the file with max-age=300, so a build asked for at once would read the old record. It then checks that the address serves this commit's file and fails rather than ask for a build that would publish a stale one. The hook's URL is kept on the tetrak-site environment, which only main may deploy to, so a workflow on another branch cannot read it. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.2 <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.
Why
The security watch at tetrak.dev/security/ is built from
docs/advisories/record.json, which the site fetches from this repository'smaineach time it is built. Until now a change to the record reached the site only on the Monday rebuild, or when someone pushed to the site's own repository. A triage merged on a Tuesday could wait six days.With this change, anyone whose triage is merged here publishes it. They need no access to the site's repository or to Cloudflare.
What changes
watch-refresh.yml. It runs on a push tomainthat changesdocs/advisories/record.json, and on a manual dispatch. It asks Cloudflare Pages to rebuild tetrak.dev through a deploy hook.raw.githubusercontent.comserves the record withCache-Control: max-age=300, so a build requested at once would read the record as it was before the merge. After the wait the job compares what that address serves with this commit's file, and fails without requesting a build if they differ.docs/advisories/README.mdtelling triagers that a merged record reaches the site by itself, in about ten minutes.The secret
The hook's URL is the secret
CLOUDFLARE_DEPLOY_HOOKon a newtetrak-siteenvironment, which onlymainmay deploy to. A workflow on any other branch cannot read it, and a pull request from a fork never sees it. All the URL can do is ask for a build of the site as it stands. Both the environment and the secret are already set up.Testing
zizmor --min-severity medium .github/workflows,actionlintandzensical build --clean --strictpass locally.record.json, so merging it will not trigger it. To test after merging: run "Refresh the security watch" by hand from the Actions tab and check that a deployment named for the hook appears in Cloudflare.ci:so that no release is cut.🤖 Generated with Claude Code