A GitHub Action that patches the pnpm advisories Dependabot cannot — via a GitHub App token
Dependabot cannot update transitive dependencies on pnpm. Building the GitHub Action that patches them, and why its credential decided the design.

On this page
Introduction
Dependabot reported four high-severity advisories on this blog’s repository, and I wondered why it never raised a pull request with the security patch. I suspected the reason was that the vulnerable package was a transitive dependency, which Dependabot cannot bump.
The guess was right, and the reason is structural: Dependabot does not support transitive dependency updates for pnpm at all. The same issue would not have come up had I been using npm. Left alone, the alerts would have stayed open indefinitely.
I tried several approaches including a Claude routine, but the solution that shipped is a GitHub App bot patching them on a schedule. This article covers the triage and how the final decision was made.

pnpm-lock.yaml.Why Dependabot never opened a pull request
Dependabot cannot patch a transitive dependency on pnpm, even with its security updates switched on:
INgh api repos/oharu121/<repo-name>/automated-security-fixesOUT{"enabled":true,"paused":false}This command confirms that the security feature was on. However, Dependabot had opened zero security pull requests. The two previous transitive alerts, nanoid and path-to-regexp, had both been patched by hand.
The cause is pnpm, not transitiveness. dependabot-core#13177 is open: Dependabot errors out saying it does not support updating transitive dependencies for pnpm. Underneath it, pnpm#12744 records that pnpm update <dep>@<version> is a no-op on a transitive dependency, and that is the exact command Dependabot’s updater runs.
The fix the repository already had
Now we know that pnpm update wouldn’t fix the issue because pnpm update is a no-op on a transitive dependency. The fix that this repository previously adopted was override.
overrides: nanoid@<3.3.18: ^3.3.18 path-to-regexp@<6.3.0: ^6.3.0The overrides live in pnpm-workspace.yaml. Everything that matters here is on the left of the colon, and the two forms behave in opposite ways:
| Written as | What it matches | Lifetime |
|---|---|---|
nanoid@<3.3.18: ^3.3.18 | only a resolution below 3.3.18 | goes inert once the tree passes 3.3.18 |
nanoid: ^3.3.18 | every nanoid in the tree, forever | permanent |
The key is a selector, not a name. The range-keyed form applies only while something still resolves below the patched version and retires itself afterwards, whereas the bare name pins the dependency permanently, so the day a legitimate dependent needs nanoid 4.x it is forced back to 3.x and breaks.
First attempt: A scheduled routine on Claude cloud session

It worked. On its first run it opened a pull request with a correctly range-keyed override, a comment block matching the file’s existing style, and a body that transcribed the audit accurately. It took about fifteen minutes.
One thing nagged, though. It printed this on every install:
[WARN] Unsupported engine: wanted: {"node":">=24"} (current: {"node":"v22.22.2","pnpm":"11.3.0"})The cloud environment ran Node 22 against a repository that declares >=24. Its pnpm check and pnpm build were therefore green against a runtime the site does not ship on, which meant its own verification could not be trusted without CI re-running the same commands.
Then I asked the question that changed the design: do we really need AI involved, or can we make it completely mechanical?
| Step | Needs human judgement? |
|---|---|
Run pnpm audit --json | No |
Skip packages declared in package.json | No, a lookup |
Derive pkg@<X: ^X from the advisory | No, the version is a field in the JSON |
| Write the override, install, check, build | No |
| Write the pull request body | No, it was transcribed audit fields |
| Decide a runtime override needs route verification | Yes |
| Diagnose an override that will not resolve | Yes |
The two that need judgement are rare, and the design had already decided the agent was not allowed to act on either of them. So it was doing clerical work every day in order to be available for an exception it would have escalated anyway.
How the workflow runs
Every “No” row above became a step in advisory-patch.yml, and the two “Yes” rows became an escalation:
- Install dependencies, so the audit runs against the tree the repository actually resolves.
- Detect and apply.
advisory-patch.tsreadspnpm audit --json, skips anything declared inpackage.json, derivespkg@<X: ^Xfrom the advisory, writes it intopnpm-workspace.yaml, and installs. - Escalate anything needing judgement, as an issue rather than a pull request. These are the two “Yes” rows: a runtime-scoped advisory, and an override that will not resolve or no longer covers the advisory.
- Verify the patch. Audit again and confirm the override took.
- Open the pull request, with the body transcribed from the audit fields.
The detect step and the verify step both call the same function, classify(), and that is where every mechanical decision actually happens. It runs each audited package through four gates in order, sorting it into one of three buckets: patch it, escalate it, or leave it alone.
When a single package carries four advisories, as fast-uri did, the override has to clear all four at once, so classify() takes the highest patched floor in the group rather than the first one it reads.
Step 4 is the only caller that changes the chain, and the overrides check is why.
By the time step 4 runs, step 2 has already written this package into pnpm-workspace.yaml, so that check would drop the exact package step 4 is asking about, and step 4 would report a clean tree no matter what pnpm install resolved.
Running the script as --verify turns off the overrides check and leaves the other three in place. It also reads the detect step’s report and checks only the packages that step patched.
Why credential matters when running the workflow
A GitHub Action is undoubtedly better than Claude’s cloud session. It runs NODE_VERSION: "24", the same as CI, so its verification means what it says. It finishes in seconds. And the logic lives in a .ts file that pnpm check type-checks and anyone can run locally.
The workflow has to open the pull request that CI checks, and a push made with GITHUB_TOKEN triggers no workflow run. The pull request still opens; the check run never starts. GitHub blocks it so that a push-triggered workflow cannot retrigger itself in a loop.
This repository’s auto-merge workflow already runs on GITHUB_TOKEN without that problem, because it sits downstream of CI rather than upstream of it.
Dependabot is exempt from the recursion guard because it is a separate app identity rather than GITHUB_TOKEN, which is why its pull requests do get checks. This is the exact pattern we should follow.
A personal access token (PAT) borrows my identity, so author.login cannot tell the automation apart from me, and the auto-merge gate had to fall back to matching a branch name that anyone could type.
The final landing solution: GitHub App
A GitHub App solves that by having an identity of its own. Its installation token is minted per run and revoked when the job ends, and the merge gate becomes an authorship check again.

Most of the setup happens in GitHub’s settings pages:
- Register the App under Settings → Developer settings → GitHub Apps, granting it Contents, Pull requests and Issues write.
- Generate a private key, which downloads a
.pemfile you get exactly one copy of. - Install it on the repository. Registering and installing are separate acts, and an App that is registered but not installed fails at the first API call.
- Add two repository secrets: the App’s Client ID, and the whole
.pemincluding its header and footer lines.

Those two secrets meet the workflow in one step, which mints the token everything else uses:
permissions: contents: read
jobs: patch: runs-on: ubuntu-latest steps: - uses: actions/create-github-app-token@v3.2.0 id: app-token with: client-id: ${{ secrets.ADVISORY_APP_CLIENT_ID }} private-key: ${{ secrets.ADVISORY_APP_PRIVATE_KEY }} permission-contents: write permission-pull-requests: write permission-issues: write
- uses: actions/checkout@v7 with: token: ${{ steps.app-token.outputs.token }}What is easy to get wrong in that snippet:
- It is
client-id, notapp-id, because v3 marks the older input deprecated. - The workflow-level
permissionsstays atcontents: read, because the write scopes belong on the App token. Putting them there would grant them to aGITHUB_TOKENthat no step here reaches for. checkouthas to be handed the token explicitly, because its default isGITHUB_TOKEN. Take that default and the eventual push triggers no CI run.
What shipped
The workflow runs daily at 10:17 JST. On a quiet day it installs, audits, finds nothing and exits in about a minute.
On 2026-09-05 it found the same fast-uri advisory this article opens with, wrote the override, verified on Node 24, and opened a pull request. Auto-merge admitted it and squashed it, with nobody touching the repository.

What the first escalation exposed
On 2026-10-03 the patcher filed its first issue instead of a pull request, for http-cache-semantics (GHSA-ch52-4w7c-c8xp), a cache that can disclose one user’s cached response to another.

astro, a production dependency, which is what made the patcher call it runtime-scoped.The runtime flag reads the dependency graph, not the code. The only file in astro that imports http-cache-semantics is assets/build/remote.js, which caches remote images during astro build. A build has no second user to leak a response to, and no patched release exists, so the Dependabot alert was dismissed as tolerable risk and the issue closed with that reasoning.
The same run held a second advisory that never reached the issue. fast-uri had a new one, GHSA-hrr3-gc8f-f4qj, patched in 3.1.8. The override the patcher wrote on 2026-09-05 was fast-uri@<3.1.6: ^3.1.6, the installed 3.1.7 already satisfied it, and the overrides check skipped the package by name:
skip fast-uri: already carries an overrideESCALATE http-cache-semantics: runtime-scopedA live advisory on an overridden package means the override is too low. pnpm audit reads the installed tree, so an override that covered the advisory would have removed it from the report.
That gate now escalates instead of skipping, and the fast-uri override was raised to ^3.1.8 by hand. The runtime check still applies, so an overridden package whose advisory reaches production code keeps that warning in the issue:
if (overridden.has(name) && !ignoreOverridden) { skipped.push(`${name}: already carries an override`); const runtime = !group.flatMap((a) => a.findings).every((f) => f.dev === true); escalations.push({ name, reason: runtime ? "existing override does not clear it, runtime-scoped" : "existing override does not clear it", detail, // each advisory's patched range, plus its resolution paths }); continue;}The verify step had the same blind spot from the other side. --verify turned off the overrides check for every package, so a stale override anywhere would fail a run that had just patched something else, and name the stale package as the one that did not take.
It now checks only the packages its own run patched, read from the report the detect step already writes:
node scripts/advisory-patch.ts --verify --out "$RUNNER_TEMP/after.json"node scripts/advisory-patch.ts --verify "$RUNNER_TEMP/advisory.json" --out "$RUNNER_TEMP/after.json"const report = JSON.parse(readFileSync(reportFile, "utf8")) as Report;verifyNames = new Set(report.patched.map((p) => p.name));
const advisories = Object.values(readAudit()).filter( (a) => verifyNames === null || verifyNames.has(a.module_name),);Summary
We have learned that Dependabot does not support transitive dependency updates for pnpm at all. That’s why Dependabot never opened a security pull request on my repo.
A push made with GITHUB_TOKEN triggers no workflow run. That’s why we need a different credential other than GITHUB_TOKEN to trigger the workflow.
The first escalation found two gaps in the patcher itself: a check that skipped an overridden package instead of reporting that its override was too low, and a runtime flag that follows the dependency graph rather than the code that actually runs.
A GitHub App was the credential that fit: an identity of its own, and a token minted per run. This is my first time creating one, and it is something I would definitely want to dig into further.
References
- dependabot-core#13177, the open issue tracking pnpm transitive dependency support
- pnpm#12744, where
pnpm up dep@versionis confirmed not to work on transitive dependencies - dependabot-core#10534, pnpm v9 lockfiles silently ending Dependabot alert coverage
- pnpm’s
overridesdocumentation, including the range-keyed selector form - actions/create-github-app-token, where
app-idis deprecated in favour ofclient-id



