GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ci: open automated PRs for fixable audit findings by denolfe · Pull Request #19217 · payloadcms/payload

Conversation

@denolfe

@denolfe denolfe commented Oct 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The daily audit-dependencies workflow now opens a PR that fixes audit findings with a valid upgrade path. Codex (OpenAI's coding agent) makes the edits, and a person reviews and merges each PR.

 .agents/skills/audit-dependencies/SKILL.md   # rewritten CI-first, uses the audit action
 .github/
 ├── scripts/audit-deps/
+│   ├── prompt.md, codex-config.toml, codex-output.schema.json
+│   ├── report.mjs, decide.mjs, github.mjs   # findings, next step, PR state
+│   ├── path-guard.mjs, content-guard.mjs    # patch checks
+│   ├── codex-contract.mjs                   # prompt, result parsing, PR body
+│   └── cli.mjs
 └── workflows/
+    ├── audit-dependencies-branch.yml        # pipeline for one branch
     ├── audit-dependencies.yml               # calls it for main and 3.x
     └── main.yml                             # Content API tests skip bot PRs

The audit reports findings every day, but a person still makes each fix by hand. For findings with a clear upgrade path, this workflow takes over that loop. Later jobs treat Codex's patch as untrusted and check it before a bot opens the PR.

Changes

  • Pipeline per branch (audit-dependencies-branch.yml)
    • precheck runs the audit and picks the next step: none, dry-run, create, update, skip, close, or blocked.
    • fix runs Codex with the rewritten skill and uploads the patch and Codex's JSON result.
    • verify applies the patch on a fresh runner. It runs the guards, the install, a re-audit, and the builds.
    • open_pr repeats the guards and opens or updates the PR on ci/audit-deps-fix-<ref>.
    • housekeeping closes a stale PR, or comments when a person has pushed to the bot branch.
    • status fails on any failed job or on findings without a fix PR. It only warns when an open PR covers the findings.
  • Audit skill (.agents/skills/audit-dependencies/SKILL.md)
    • The skill now targets CI first and runs the audit-dependencies action instead of the shell script. Local use still works.
    • A major bump needs release notes for every major in the range. Codex finds them through the package's repository metadata, including directory for monorepo packages.
    • When Codex cannot find the notes, or a breaking change affects our usage, the advisory goes to "Needs a Person" in the PR body.
  • Codex sandbox
    • Codex can write only to the checkout and /tmp. Network access is limited to the npm registry and GitHub hosts.
    • The drop-sudo safety strategy removes sudo before Codex starts. The checkout's .codex/config.toml is ignored (untrusted project). Its MCP servers (tool servers Codex could call) never load.
    • The Codex CLI is pinned to 0.165.0. The fix job runs on ubuntu-24.04 because drop-sudo fails on 26.04.
  • Patch checks
    • The patch may touch only package.json, pnpm-lock.yaml, and pnpm-workspace.yaml. Symlinks, renames, deletes, and mode changes fail.
    • Manifest changes must be planned version bumps. New dependencies, scripts, and overrides changes on the consumer-facing scope fail.
    • The lockfile must match a clean regeneration from the patched manifests.
    • Every advisory Codex claims as fixed must be gone from the re-audit.
  • PR body
    • A trusted change table comes first. Codex's analysis follows, with all HTML comments stripped.
    • A hidden marker lists the fixable advisory set. It lets the next run skip, update, or close the PR.
  • Gating
    • Only runs from main with default inputs (consumer-facing, high) change PRs. Every other run is a dry run.
    • The PR token comes from a dedicated GitHub App in the audit-deps environment. The App is not a ruleset bypass actor (an identity allowed to skip branch protection).
  • main.yml
    • Content API tests skip bot PRs and ci/audit-deps-fix-* branches. The job assumes an AWS role. Bot PRs run dependency versions no person has reviewed.

Design Decisions

Codex runs in a job with no write token. Its output leaves the runner only as an artifact. verify and open_pr run on fresh runners and repeat every check before anything uses the patch. The job that holds the App token never executes dependency code.

A dry run on this branch confirmed the sandbox boundary. Codex's shell can write to the checkout and /tmp. Writes to $RUNNER_TEMP (the runner's temp folder, which holds GITHUB_ENV and the trusted Codex config) fail with a read-only file system error.

When a person closes the bot's PR, the next run skips that exact advisory set. A new advisory opens a fresh PR. When a person pushes to the bot branch, the workflow stops updating it and leaves a comment.

Rollout:

  1. After merge, remove ci/audit-deps-auto-pr from the audit-deps environment's branch policy, so only main remains.
  2. Dispatch one run from main and review the first PR.
  3. The main.yml change also needs a 3.x backport for bot PRs that target 3.x.

Overall Flow

audit-dependencies (daily, main and 3.x)
  precheck        audit, read PR state, pick next step
  fix             Codex edits manifests and lockfile (sandboxed, no write token)
  verify          guards, lockfile replay, install, re-audit, builds
  open_pr         guards again, App token, create or update PR
  housekeeping    close a stale PR, or comment when blocked
  status          red on failures or unfixed findings, warning when a PR covers them

References / Links

  • openai/codex-action: GitHub Action used to run Codex
  • Codex sandboxing: sandbox and bubblewrap behavior
  • openai/codex-action#188: drop-sudo failure on ubuntu-26.04

🤖 Written with AI

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
denolfe added 25 commits October 29, 2026 13:09
@denolfe
ci: open automated PRs for fixable audit findings
e14e9a7
@denolfe
chore: add audit-deps patch path guard
eec87e6
@denolfe
chore: add audit-deps content guard and change table
1e95f55
@denolfe
chore: harden audit-deps change table against injected keys
87ebde9
@denolfe
chore: add codex prompt, profile, and output contract for audit fixes
484bdef
@denolfe
chore: close comment-stripping gaps in codex PR body
440a696
@denolfe
chore: add audit-deps CLI and PR housekeeping helpers
a9aa195
@denolfe
chore: cover --fixable validation in audit-deps CLI spec
9b1da13
@denolfe
chore: make audit-dependencies skill CI-first
201e711
@denolfe
chore: forbid code changes in audit-dependencies skill
02774a1
@denolfe
chore: run codex fixes and open audit PRs from audit workflow
df8e15c
@denolfe
chore: isolate post-codex git and pin lockfile check to base
6835449
@denolfe
chore: harden audit workflow against forged patches and base drift
b93a442
@denolfe
chore: run codex fix job on ubuntu-24.04
a71935b
@denolfe
chore: ignore checkout codex config in audit fix job
1787c13
@denolfe
chore: gate audit PRs to main and move secrets to audit-deps environment
a8dd9ca
@denolfe
chore: pass audit-deps environment secrets to the reusable workflow
a5d294a
@denolfe
chore: drop secrets comments
d14a1a8
@denolfe
chore: point codex pnpm home and store at /tmp
cd81f1b
@denolfe
chore: assert pnpm data home and update store dir
29f1bb7
@denolfe
chore: probe codex sandbox writable roots (temporary)
34b6f07
@denolfe
chore: pin codex cli version in audit fix job
e896759
@denolfe
chore: remove codex sandbox probe
5268fdd
@denolfe
chore: name re-audit step for expected unfixable findings
83c2060
@denolfe
chore: drop low-value audit-deps tests
1bd3f7e
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the created-by: Payload team label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖
This PR introduced no changes to the esbuild bundle! 🙌

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@denolfe
chore: point audit skill at repository directory for changelogs
9fc8b1d
@denolfe
denolfe deployed to audit-deps October 29, 2026 20:26 — with GitHub Actions Active
denolfe added 7 commits October 30, 2026 13:56
@denolfe
chore: harden audit rejected-PR and head checks
2b6a2ac
@denolfe
chore: rewrite audit skill as a bump reviewer
61b8872
@denolfe
chore: tighten audit skill for the read-only sandbox
dde0596
@denolfe
chore: run audit pipeline per bump and unit
84697ea
@denolfe
chore: isolate audit jobs from cache and artifact poisoning
ad5a5d3
@denolfe
chore: run audit refs one at a time
4aa4a68
@denolfe
chore: seal audit artifacts by producing job
e104086
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 18:57 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 18:57 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 18:57 — with GitHub Actions Failure
denolfe added 7 commits October 30, 2026 15:18
@denolfe
chore: neutralize doubled-at mentions and more github link forms
8514e57
@denolfe
chore: fix audit seal attempts, housekeeping errors, and 0.x majors
d2a59ad
@denolfe
chore: update conflicted audit PRs
f367243
@denolfe
chore: let a rejected audit major's fallback join the group
23ab1d4
@denolfe
chore: open audit PRs on the branch head
f45f3b9
@denolfe
chore: refuse audit bumps that would not raise a version
f41ce01
@denolfe
chore: skip audit specs already at the target
d583b3c
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:14 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:14 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:14 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:21 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:21 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:21 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:21 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:21 — with GitHub Actions Failure
@denolfe
denolfe had a problem deploying to audit-deps October 30, 2026 20:21 — with GitHub Actions Failure
@denolfe

denolfe commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

This got a little wild, will be superseded by a smaller scoped PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@denolfe denolfe closed this Nov 2, 2026
@denolfe denolfe mentioned this pull request Nov 3, 2026
ci: automatically create dep update PRs that fix GHSA findings #19295
Merged
denolfe added a commit that referenced this pull request Nov 4, 2026
@denolfe
ci: automatically create dep update PRs that fix GHSA findings (#19295)
487fa2d
The daily dependency audit now opens PRs that fix the advisories it
finds, on `main` and `3.x`. One PR holds all non-major bumps, and each
major bump gets its own draft PR.

Merge after #19300, which skips bot PRs in the `3.x` content API tests.

```diff
 .github/
 ├── actions/
 │   ├── audit-dependencies/src/lib/bumpAdvisor.ts  # traces the whole graph when a module leaves its chain
 │   └── setup/action.yml               # pins setup-node to a commit SHA
 ├── scripts/
+│   └── audit-deps/                    # plans bumps, prepares commits, renders PR bodies
+│       ├── cli.mjs                    # plan, prepare-prs
+│       ├── plan.mjs                   # builds and checks the bump and PR plan
+│       ├── step-handoff.mjs           # checks the data each step gives the next
+│       └── commands/                  # github-script steps: decide PR steps, publish
 └── workflows/
     ├── audit-dependencies.yml         # calls the branch workflow once per ref
+    ├── audit-dependencies-branch.yml  # one job: audit, plan, prepare, publish
     └── main.yml                       # runs audit-deps specs, skips bot PRs in content API tests
```

The audit action already reports which direct dependency bump clears
each advisory. Until now a person had to apply that bump by hand. This
PR applies the plan in CI, takes over from Dependabot security PRs, and
supersedes #19217, which had Codex write the fix.

Resolves PYLD-5012

**Example dry run:** [run
41712179405](https://github.com/payloadcms/payload/actions/runs/41712179405)
audits `main` and `3.x`. The run summary lists the PRs it would open.

**Example PR Body**

<img width="1040" height="900" alt="image"
src="https://github.com/user-attachments/assets/ec21a4de-9112-4187-a71f-b710adcc50c8"
/>

## Changes

- **Branch workflow** (`audit-dependencies-branch.yml`)
  - One job per ref audits, plans, prepares and publishes.
- Only the publish step holds a write token. It is a GitHub App token,
minted after prepare.
- The scripts and the audit action come from the tooling checkout (a
sparse clone of the triggering commit). The audited ref gives only its
tree and its allowlist.
- A dry run from a branch therefore tests that branch's audit action
too.
- Publish runs only when prepare finishes. It still runs when the App
token mint fails, so the summary can report the missing token.
- **Pinned actions**
- Every action the job runs, including those in the shared setup action,
is pinned to a full commit SHA.
- The `setup-node` pin in the setup action applies to every workflow
that uses it. It pins the commit `@v6` resolves to today.
- **Plan and prepare** (`.github/scripts/audit-deps`)
- `plan` groups the fixable bumps: non-major bumps in one PR, each major
in its own draft PR.
  - `prepare-prs` makes each PR one bot commit on the audited commit.
- Bumps use `pnpm install --lockfile-only --ignore-scripts`. No package
install scripts run.
- A range specifier such as `>=5.0.0` is left unchanged. The re-audit
shows whether the other edits fix the advisory.
- A path guard rejects any change outside the bumped manifests and the
lockfile.
- A re-audit runs on each prepared commit. A PR fails if an advisory it
claims is still reported.
- **Step handoffs**
- One plan module builds and reads the plan. Every step that reads it
checks that each PR names known bumps.
- The handoff module checks `pr_steps` and `prepared.json` (the data one
step gives the next) when it writes them and when it reads them.
- A bad handoff stops the run before any push. An update without a PR
number is one example.
- `prepare-prs` records every planned PR, including skipped and blocked
ones. Publish reads only that file.
- **Existing PRs**
- Each PR body ends with a fingerprint (a hidden comment with the PR id,
bumps and advisories).
- An unchanged PR is skipped. A PR with a person's commits is not
updated.
  - A PR a person closed is not opened again for the same change.
  - Bot PRs that are no longer planned are closed.
- When GitHub has not yet computed whether a PR has conflicts, publish
asks again, up to three times.
- **PR body**
- Lists each bump with its advisories, upstream release notes and
commits.
- An advisory counts as fixed only when none of its findings still
reaches a bumped dependency.
- Each bump lists as affected only the packages that declare its
dependency.
  - Major PRs start with a review banner.
- Upstream details load one bump at a time. This keeps a large group PR
under GitHub's secondary rate limit.
- A repository owner or name from the registry must be a plain path
segment. Other values give no upstream links.
- Outside text is sanitized. Issue references, mentions and HTML
comments cannot break the body or notify anyone.
- Upstream GitHub links go through `redirect.github.com`. A link to an
issue cannot add a reference event to it.
- **Bump advisor** (`bumpAdvisor.ts`)
- The advisor first traces only the advisory's chain (the packages
between the direct dependency and the vulnerable module).
- When that trace finds no copy of the module, the advisor now traces
the whole graph before it reports `clear`.
- A renamed package no longer gives a false fix. `@sentry/nextjs`
10.76.2 renames `@sentry/bundler-plugin-core` to
`@sentry/bundler-plugins`. The new package still pulls `glob` 13.
- The `glob` and `minimatch` advisories through Sentry now show as "no
fix available". Sentry merged the `glob` 14 fix but has not released it.
- When a release clears them, the planner opens the Sentry PR. No
allowlist entry is needed.
- **`audit-dependencies.yml`**
- Real runs audit at `moderate` severity. At `high`, `main` had no
findings.
- **`main.yml`**
  - audit-deps specs run in CI.
- Content API tests skip bot PRs. That job assumes an AWS role. Bot PRs
run dependency versions no person has reviewed.
- **Dry runs**
  - Runs from other branches, or with non-default inputs, only report.
- A dispatch for one ref is a dry run. A real manual run needs `ref:
both` from `main`.
- Real runs share one concurrency group (a queue that keeps only its
newest pending run). Each dry run gets its own group.
  - A dry run therefore cannot replace a pending real run.

## Design Decisions

- **No AI in the fix.** pnpm applies the bump the audit planned. The PR
body is built from registry and GitHub data. #19217 had Codex write the
change; this PR drops that.
- **Token per step.** Steps that run pnpm or read registry data hold the
read-only `github.token` at most. The App token exists only in the
publish step.
- **Lease on push.** Publish pushes with `--force-with-lease` (a push
that fails if the remote branch moved since the plan read it). A
person's push is never overwritten.
- **No cache.** The job later holds a write token. It restores no cache
another workflow could have written.
- **Re-audit stays strict.** The advisor's trace is a guess that bounds
registry requests. The re-audit is the check. A PR that still reports a
claimed advisory fails instead of opening.
- **Accepted costs**
  - A PR fails when the re-audit disagrees with the plan.
  - A failed group PR is not retried per bump.
  - Major PRs are drafts. A person reads the release notes before merge.
  - A closed group PR stays closed only for the exact same set of bumps.
- `main`'s audit action audits the `3.x` tree. A later action change on
`main` must also work on `3.x`.
- Each prepared PR runs a full re-audit. The job time grows with the
number of PRs.
- PRs that touch only `.github/scripts/audit-deps` run the full test
suite. The unit test job depends on the build job.
- The `audit-deps` environment allows the feature branch and has no
required reviewers. Using it from that branch needs write access. The
branch leaves the policy after merge.
- A consumer package whose dependencies fail to resolve gives no
findings. The re-audit then counts its advisories as fixed, and a
planned PR can close as stale. That audit behavior is already on `main`.

## Overall Flow

```diff
 audit-dependencies.yml (daily schedule or dispatch; refs main and 3.x)
-  audit action          -> report
+  audit-dependencies-branch.yml, once per ref
+    checkout tooling    -> scripts and audit action from the triggering commit
+    audit action        -> report on the audited ref's tree
+    plan                -> bumps grouped into PRs
+    decide PR steps     -> create, update, skip, skip-rejected or blocked; stale PRs
+    prepare-prs         -> per PR: bump, lockfile, path guard, re-audit, commit
+    mint App token      (real runs only)
+    publish             (only when prepare-prs finishes)
+                        -> push with lease, create or update PR, close stale PRs, summary
```

## References / Links

-
[actions/create-github-app-token](https://github.com/actions/create-github-app-token):
App token for the publish step
- [git push](https://git-scm.com/docs/git-push): `--force-with-lease`
semantics
- [pnpm install](https://pnpm.io/cli/install): `--lockfile-only` and
`--ignore-scripts`
-
[getsentry/sentry-javascript#25969](getsentry/sentry-javascript#25969):
`glob` and `minimatch` advisories in `@sentry/bundler-plugins`
-
[getsentry/sentry-javascript#26014](getsentry/sentry-javascript#26014):
Sentry fix that moves `glob` to 14, not yet released

🤖 Written with AI

This branch had an error being deployed

1 failed deployment
audit-deps — d583b3cd Deployed Oct 30, 2026 by denolfe via audit (3.x) / research (3.x, sentry-nextjs-10) #105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

created-by: Payload team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@denolfe
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.