shivammittal.in

Side quests/November 2026

Patchhound

Reads your code before it alerts, fixes what it can in one pull request, and never merges

Shivam Mittal

27 November 2026

Codenpx patchhound init

Abstract

Patchhound watches a repo's npm dependencies for security advisories, reads the code to judge which ones it can actually reach, alerts only on those, and keeps one pull request open that fixes what it can without breaking the build, type check or tests. It runs in the repo's own GitHub Actions, split so that the job running the project's code can never write to the repo, and it never merges anything. On four real web apps, 1,134 advisory matches became 25 alerts. On March 2025 copies of shadcn/ui and Excalidraw, one pull request each fixed 46 advisories, and every check that passed before still passed. I built it in nine days, with 529 tests.

1Too many alerts, and the wrong ones

Most dependency alerts are about code your app never runs. A lockfile scan answers one question, whether a vulnerable version is installed, and on four real web apps I work on that came to 1,134 matches. Many were like brace-expansion, which matters only when someone feeds a hostile pattern to a build tool, or fast-uri, which ajv uses only on schemas the developer wrote.

Severity does not sort them either. When I let every critical advisory alert no matter what, 23 of the 26 critical alerts were for code nothing could reach. People mute a tool like that, and then they miss the one alert that mattered.

This year made the cost of missing one plain: attackers took over the npm account of axios's lead maintainer and published two backdoored versions [1]. GitHub added reachability verdicts to Dependabot alerts in October, in preview and for Enterprise Cloud repos [2]. I wanted something any repo could run that reads the code before it alerts, and then does the fixing too.

2What a run does

Scan. It reads the lockfile (npm, pnpm or yarn) into a dependency graph, and checks every package against OSV, which also lists malicious packages [3], and against CISA's catalogue of vulnerabilities known to be exploited [4]. For each finding it works out the cheapest fix: refresh the lockfile, bump a dependency, add a scoped override, or nothing yet. On three of the apps it found every advisory osv-scanner found, and all 194 of its “a refresh fixes this” claims held when I ran the real package managers.

Triage. It reads the code for evidence: which files import the package, whether they call the function an advisory names, and whether that code runs on the server, in the browser or only at build time. Plain rules settle the easy cases. Jev, TypeSafe's fast classifier, takes a first pass, and Claude checks the answers that would send an alert. Then a policy with no model in it decides: alert now, weekly digest, or fix.

Fix. It runs the project's build, type check and tests first, so only checks that already pass count. Then it applies the safe changes (lockfile refreshes, patch and minor bumps), then the major upgrades, and runs the checks after each. When a step breaks something, plain code splits it into smaller groups to find the culprit, and one Claude Code session adapts the code to the upgrades that need it, within a $10 budget by default. Whatever still breaks a check is left out, and the pull request says why.

Malware. A malicious package gets a pull request of its own straight away, made by editing the lockfile only. Nothing is installed or built first, because installing it would run it.

  • Runs code you have not read
  • Can write to the repo

scan

Reads the lockfile and the code, triages, and sends alerts.

Runs: Nothing from your project.

Holds: Read-only token. Claude, Jev and Slack keys.

when there is something to fix

fix

Installs the project, runs its checks, applies fixes, runs Claude Code.

Runs: Your installs, install scripts, build, tests and a coding agent.

Holds: Read-only token and Claude's sign-in. Nothing else.

a git bundle

publish

Checks the fix job's commits and opens or updates the pull request.

Runs: Nothing from your project.

Holds: A write token. Pushes only to patchhound/fixes.

Figure 1. One run, every 4 hours, in the repo's own GitHub Actions. The job that runs code nobody has fully read can never write to the repo, and the job that can write never runs that code. No box is both orange and blue. Nothing is merged: the last step is a pull request for a person.

The fix job is the dangerous one: installs, install scripts, tests and a coding agent are all code nobody has fully read. So it holds a read-only token and Claude's sign-in and nothing else, and hands its work over as a git bundle. The publish job runs nothing from the project. It takes only commits that start where they say they do and leave .github/ and Patchhound's own config alone, and it pushes them to one branch.

3Reading the code before alerting

The plan was for Jev to answer most triage questions and for Claude to judge only what Jev was unsure of. To test it, I labelled 66 advisories across the four apps by reading their code: is the vulnerable part reachable, and would I want an alert about it now? The eval then scored each strategy on the same answers.

Jev alone

22%

Claude when Jev is unsure

36%

Claude checks each yes

100%

Same, but every critical alerts

53%
0%25%50%75%100%

alerts worth sending

Figure 2. Share of alerts that were worth sending, scored against 66 labels I checked by hand, in one evaluation run on four real web apps. The dark line is the 80% bar triage had to clear. Every strategy alerted on all 3 critical advisories that deserved it. In the shipped strategy, in blue, Claude checks every answer that would send an alert, and only Jev's confident no skips it. It scored 84%, 91% and 100% on three runs.

The plan failed in one direction. In that run every confident no from Jev was right, but its confident yes matched my labels about one time in three, and each of those went out as an alert unchecked. So Claude now checks every answer that would send an alert, and only Jev's confident no skips Claude. Forcing every critical advisory to alert pulled the same strategy down to 53%.

On a full first scan of the four apps, that came to 25 alerts from 1,134 matches. Running in GitHub Actions on my company's landing page, Jev judged all 138 findings and Claude checked 73 of them, for $1.77.

4The React inside Next.js

One kind of advisory never shows up in a lockfile. Next.js does not install React's server-component code from npm: it ships its own copy inside next/dist/compiled. React's advisories name the react-server-dom packages, so in a Next.js app a lockfile scanner cannot see them until Next.js publishes an advisory of its own.

When React published a critical remote code execution advisory on 10 November 2026 [5], it named only those packages. Patchhound reads which React build each version of next ships, from next's published files, and checks React's advisories against that copy. On three of the four apps, the copy inside next was built before the advisory.

5Fixing without breaking anything

To test fixes on real code without sending pull requests to other people's projects, I made private copies of shadcn/ui and Excalidraw as they were in March 2025, plus a small app pinning event-stream 3.3.6 and ua-parser-js 0.7.29, two packages that once shipped malware. Then I let Patchhound open its pull request on each.

CopyFixedWorstStill passing
shadcn/uipnpm 9 monorepo, 44 files changed461 critical, 7 highbuild, type check, tests
Excalidrawyarn 1 workspaces, 7 files changed465 highbuild, type check, tests
Malware fixturenpm, 2 files changed43 malicious versionstests, run after only

Table 1. One pull request per copy. Fixed counts advisories. The critical one on shadcn/ui is the Next.js remote code execution bug from December 2025, which is on CISA's exploited list. On the malware fixture no check ran before the change, because installing the project would have run the malware.

Each pull request lists every advisory, whether the code reaches it, what changed, and the checks before and after. It also lists what the new versions bring. On both copies, the new Next.js carries a React build with the November advisory and no fixed version yet, and the pull request says so.

On real apps: two private apps got every finding fixed, 74 of 74 and 50 of 50, with their checks green. My company's landing page got one pull request fixing 65 findings, with the build passing before and after. A URL shortener of mine went from Next.js 14 to 15, with Claude Code adapting about 18 files. Its build needs a database, so there only the type check could verify the change.

6What I take from it

Exposure is the question, not severity. A critical advisory in code nothing reaches is noise, and a moderate one in a route that parses uploads is not.

Check a fast model where its mistakes cost something. Jev's no was safe to trust and its yes was not. Sixty-six labels and one eval run showed that within a day.

The model is the small part. About a tenth of the 10,000 lines talk to a model. The rest reads four lockfile formats, proves fixes with the real package managers, runs checks before and after, and keeps secrets away from the code that runs.

Not merging is a feature, for now. A pull request with the checks before and after takes a person a minute to review. Auto-merge is written, and parked until this part has run on more repos.

7Limits

References

  1. [1]axios maintainers. Post mortem: axios npm supply chain compromise. March 2026. github.com/axios/axios/issues/10636
  2. [2]GitHub. Prioritize Dependabot alerts with reachability analysis. Changelog, 28 October 2026. github.blog/changelog
  3. [3]OSV, the open source vulnerability database: osv.dev
  4. [4]CISA. Known Exploited Vulnerabilities Catalog. cisa.gov/known-exploited-vulnerabilities-catalog
  5. [5]React: Unauthenticated Remote Code Execution in React Server Components. GHSA-xqc2-xf4c-x3h3, 10 November 2026. osv.dev/vulnerability/GHSA-xqc2-xf4c-x3h3
  6. [6]Patchhound, code and the full GitHub Action docs: github.com/CodeGeek04/patchhound
  7. [7]TypeSafe, makers of Jev: typesafe.ai

More side quests