Repository navigation
security alerts: try the override fix itself, on one rolling pull request - #571
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An alert Dependabot cannot fix became an issue for the owner, and the fix was made by hand (#564: override floors in pnpm-workspace.yaml, the lockfile rewritten). security-alerts.yml now tries that fix itself where a floor makes it, in three jobs: - check plans the floors (tools/security-overrides.mjs: one per package and major the lockfile holds vulnerable, ^ the newest first patched version; declined, with the reason in the issue, when there is no patched version, the fix is a new major, the package is pnpm-patched, a parent-scoped or unreadable override governs it, or main has the floor already while the lockfile is still vulnerable). The alerts it takes stay out of the issues, out of both $new and $list. - install has contents: read and no token: pnpm install --lockfile-only --ignore-scripts with the floors, then verify (every alert taken fixed, every floor holding, nothing else moved). pnpm saying no version fits demotes the alerts to issues; any other failure fails the run (a report issue), never silently. - publish, the only writer, commits through the API on the planned main, keeps ONE rolling pull request on security/overrides, and starts CI and the dependency review on it. A pull request closed unmerged by hand hands its alerts back as issues; this workflow's own closes are marked closed-by-run. update-prs.yml reports on it as the kind security (only those two files, its dependency review must pass, no 3-day wait); ci.yml's hand-off covers security/. Replayed on the state before #564 with its seven alerts: the plan writes the same four floors, pnpm writes the same lockfile (the order of two keys in its overrides copy aside), verify passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The demote step read plan.json's alerts with .[] (plan.json is an object): the first real demote would have died before raising any issue. .alerts[], and a test of the step (security-overrides- demote.test.sh) that fails with the old filter. - A deterministic install failure demotes every alert the run took (no lockfile came out, so none publishes), not only those pnpm's log named. - check and install both take the run's own commit; install no longer checks out a ref read from the artifact (CodeQL: untrusted checkout, cache poisoning) and refuses a plan made on another commit. - A run that steps aside because main moved says so in its summary. - A pull request closed by hand whose text lost its alerts marker is warned about, as its close then hands nothing back. - The no-push case compares with the branch's own tree. - The CLI dispatches through a table (CodeQL: user-controlled bypass). 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.
An alert Dependabot cannot fix became an issue for the owner, and the fix was then made by hand. #564 was such a case: floors in
pnpm-workspace.yaml'soverrides, and the lockfile rewritten.security-alerts.ymlnow tries that fix itself where a floor makes it, and falls back to today's issue where it cannot. This is the third update gap found while checking what Dependabot does not cover (#565, #566).How it works
Three jobs, so that the job that rewrites the security-relevant manifests holds no write token:
check(today's job, extended) plans the floors withtools/security-overrides.mjs: one floor per package and major the lockfile holds vulnerable,^the newest first patched version. It declines an alert, with the reason written into the issue, when:web-ext>pkg) or unreadable override governs it;mainhas the floor already while the lockfile is still vulnerable.The alerts it takes stay out of the issues: they are subtracted from both
$newand$list, because an alert listed in an issue's marker is never raised again.installhas onlycontents: read, and no token appears in it. It runspnpm install --lockfile-only --ignore-scripts --no-frozen-lockfilewith the floors, so no package code is ever on disk. Thenverifychecks three things: every alert taken is fixed, every floor holds, and nothing but the floored packages moved. If pnpm says no version fits (ERR_PNPM_NO_MATCHING_VERSION,ETARGET), those alerts are demoted to issues. Any other failure fails the run, and the report job opens "Security override route failed". Nothing is left silent.publish, the only writer:security/overrides;pull_requestrun of a pull request this token opened waits for an approval,action_required(update PRs: a run that never ran decides nothing #570).A pull request closed unmerged by hand hands its alerts back as issues; this workflow's own closes are marked
closed-by-run.update-prs.ymlreports on it as the kindsecurity: onlypnpm-workspace.yamlandpnpm-lock.yamlmay change, its dependency review must pass, and there is no 3-day wait, since it is a security fix. On the update-branch path the dependency review is started again.ci.yml's hand-off coverssecurity/.The fsaunpack lockfile stays on the issue route.
Tested
Replay on real data. I took the commit before deps: undici 7.30.1 / 8.12.3 and serialize-javascript 7.1.3 (Dependabot #73-#79) #564 and its seven alerts (Reminder: after git pull, run pnpm install on your PC #73–fix(background): a player whose page reloaded while it started is no player of the new page #79), and ran the route on them:
serialize-javascript: ^7.1.3,undici@7: ^7.30.1, a newundici@8: ^8.12.2,undici@6untouched);installstep's command (pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile) writes the same lockfile as deps: undici 7.30.1 / 8.12.3 and serialize-javascript 7.1.3 (Dependabot #73-#79) #564's. The only difference is the order of two keys in its copy of the overrides, because the new floor is appended at the end of the block;verifypasses on that lockfile, and names every vulnerable version on the old one.Unit tests (
tests/unit/securityOverrides.test.mjs, 40), covering: range parsing; the lockfile readers (the pnpm-12 first document, peer suffixes, aliases); every plan and decline rule; the edit (byte for byte against the realpnpm-workspace.yaml, CRLF and quotes kept);verify(survivors, unmet floors, churn per major, prereleases fail closed); and the bundle steps. The eight cases from a glm review fail without their fixes. Whole suite: 3080 passed.Workflow tests in WSL (
verify:linux workflows, which also ran actionlint, shellcheck and zizmor):security-alerts.test.shruns the real planner in seven new scenarios: an alert taken (no issue); one taken and one declined in the same package (the issue lists only the declined one, with its reason); an owner-closed pull request (its alert back to an issue); one this workflow closed (no decline); an alert an issue lists already (stays there); the open pull request read only for its alerts' states; a push (no plan). The old scenarios are unchanged.update-prs-decide.test.sh: 722 checks, 0 failed, thesecuritykind's cases among them.security-overrides-demote.test.shrunspublish's demote step: an issue with the marker and a row per alert, an open rolling pull request markedclosed-by-runand closed, alerts joining an open issue's marker. With the step's first filter (.[]onplan.json, which is an object), all of it fails.security-alerts.test.shalso covers a hand-closed pull request whose text lost its marker: a warning, since its close hands nothing back.A second round (glm's final review and CodeQL, fixed in the second commit):
installno longer checks out a ref read from an artifact:checkandinstallboth take the run's commit, andinstallrefuses a plan made on another;One finding did not hold: that
update-prs.ymlnever runs for this branch. Runs the token starts send noworkflow_run, soci.yml's hand-off starts it, and that now coverssecurity/.glm drafted the module, the jobs and the map of the existing workflow; its reviews and mine found and fixed these:
--paginate --jqfilter fed a page;action: nonefloors that made an empty pull request;action_requiredruns would have suppressed;Not established yet: the jobs in Actions. A manual run after the merge, with no alert open today, takes the idle path:
checkuploads the plan artifact andpublishdownloads it to see that nothing is to close. That shows whether the newactions/download-artifactv8.0.2 reads what upload-artifact v7.0.2 writes. The full route only runs when an alert Dependabot cannot fix comes in.🤖 Generated with Claude Code