Finding vulnerable dependencies is a solved problem. Every package manager has an audit command, and every scanner produces a list. Fixing them is where teams stall, because the obvious fix (bump the version) breaks builds often enough that nobody trusts it, and the list grows faster than anyone can review upgrades by hand.
Automatic vulnerability remediation only works if the automation does the same six things a careful engineer would do:
Step | What it answers | What goes wrong if you skip it |
|---|---|---|
1. Inventory | Which packages and versions do we actually ship, and why is each one here? | You fix the manifest while the lockfile or a transitive copy stays vulnerable |
2. Decide what is worth fixing | Is the vulnerable code reachable, likely to be exploited, or already exploited? | You spend a sprint on CVEs in code paths that never run |
3. Pick the lowest version that fixes every CVE in the package | What is the smallest upgrade that clears all advisories, same major first? | You fix one advisory and leave four, or jump a major you did not need |
4. Predict breakage | Do the APIs we use change? Do peer or pinned dependencies block it? | The upgrade fails to resolve, or resolves and breaks at runtime |
5. Build and test baseline versus candidate | Does the build pass before and after, in a clean environment? | A failure you blame on the upgrade was already there, or the reverse |
6. Open the PR, then confirm the CVE is gone from the default branch | After merge, does the scanner still see it on main? Does it come back? | "Merged" gets reported as "fixed" while another path still pulls in the old version |
The rest of this guide runs each step by hand with commands for npm, pip, Maven and Go, explains why npm audit fix --force is the wrong shortcut, compares what current tools automate, and then shows the same six steps automated end to end.
The Six Steps, Done by Hand
The examples below come from two small demo projects we ran on November 29, 2026: a Node project pinning handlebars@4.7.6, express@4.17.1 and jsonwebtoken@8.5.1, and a Python project pinning jinja2==2.11.2 and requests==2.25.1. Outputs are trimmed but not edited.
Step 1: Inventory what you ship, including transitive dependencies
The question is not just "which packages are vulnerable" but "why is this package here". A transitive dependency cannot be fixed by editing a line that does not exist in your manifest.
Ecosystem | Find vulnerable packages | Explain why a package is present |
|---|---|---|
npm |
|
|
pip |
|
|
Maven | OWASP Dependency-Check or your SCA tool |
|
Go |
|
|
In the Node demo, npm audit reported 8 vulnerable packages (1 critical, 4 high, 3 low). One of them, qs, is not in package.json at all:
qs arrives twice through express, so the fix is an express upgrade, not a qs one. If you need a machine-readable inventory for audits, npm sbom --sbom-format cyclonedx emits one from the lockfile.
Step 2: Decide what is worth fixing first
Three signals separate the CVEs that matter from the noise:
Reachability. Does your code call the vulnerable function, directly or through the dependency chain? Go has this built in:
govulncheckanalyzes the call graph and reports separately the vulnerabilities your code actually calls. For other ecosystems you need an SCA tool that does reachability analysis.Likelihood of exploitation. EPSS gives each CVE a probability of exploitation activity in the next 30 days:
curl -s "<https://api.first.org/data/v1/epss?cve=CVE-2021-23369>".Known exploitation. If a CVE is in CISA's Known Exploited Vulnerabilities catalog, it goes to the top regardless of the other two.
We cover how to combine these in CVSS, EPSS and KEV: how to prioritize vulnerabilities. The practical rule: reachable or known-exploited first, high EPSS next, and unreachable low-EPSS findings batched into routine upgrades rather than emergency PRs.
Step 3: Pick the lowest version that fixes every CVE in the package
Advisories for the same package are often fixed in different releases. Fix them one at a time and you open four PRs for one package. Pick the highest single fix and you may jump further than you need. The target is the lowest version that clears every open advisory for that package, and you try to stay in your current major first.
Staying in the current major works more often than most teams expect. When we measured it across 2,388 real dependency CVEs in CodeAnt's own 44 repositories, 74% could be cleared with a patch or minor upgrade inside the same major version. Majors are the minority, which is why they deserve the extra scrutiny of Step 4 rather than becoming the default.
From the Python demo (pip-audit, November 29, 2026):
Package | Installed | Advisories | Lowest fix for any one advisory | Lowest version fixing all | Major change? |
|---|---|---|---|---|---|
jinja2 | 2.11.2 | 5 | 2.11.3 | 3.1.6 | Yes |
requests | 2.25.1 | 4 | 2.31.0 | 2.33.0 | No |
urllib3 (transitive) | 1.26.20 | 7 | 2.5.0 | 2.8.0 | Yes |
idna (transitive) | 2.10 | 2 | 3.7 | 3.15 | Yes |
The jinja2 row is the trap: bumping to 2.11.3 clears one advisory and leaves four, and the only version that clears all five is a major upgrade. That is a decision for a human or a tool that can analyze the code changes, not a silent bump.
In the Node demo the picture is friendlier. All 13 handlebars advisories are fixed in 4.7.10, a patch release in the same major. jsonwebtoken 8.5.1 is different: npm reports that its fix requires version 9, which is a breaking change.
Step 4: Predict breakage before you run anything
An upgrade breaks in two ways: it fails to resolve, or it resolves and changes behavior your code depends on.
Resolution conflicts come from pins you do not control. In the Python demo, urllib3 needs version 2.x, but requests 2.25.1 caps it below 1.27, so bumping urllib3 alone fails:
The fix is a co-upgrade: move requests to a version that allows urllib3 2.x, which you were going to do anyway for its own advisories. The same pattern appears as ERESOLVE peer dependency errors in npm, as versions managed by a parent BOM such as Spring Boot's in Maven, and as minimum version selection pulling other modules forward in Go.
Behavior changes come from the APIs you actually use. List them before reading any changelog:
Then read the release notes for only those APIs across the version window. For jsonwebtoken the maintainers publish migration notes from v8 to v9; if your code calls jwt.verify with keys or algorithms those notes cover, the upgrade needs code changes, and the PR should include them.
Step 5: Build and test baseline versus candidate in a clean environment
Run the same build and tests twice: once on the current default branch (baseline) and once with the upgrade (candidate), in clean environments with the runtime your CI uses. Without the baseline, you cannot tell whether a failing test is caused by the upgrade or was already failing.
For Python, create a fresh virtual environment for each side (python -m venv) and install from the lockfile or pinned requirements; reusing your local environment hides missing pins. Match the interpreter or Node version to CI, since an upgrade can require a newer runtime than the one you test on locally.
The candidate passes only if three things hold: it installs, the tests that passed on baseline still pass, and the scanner no longer reports the CVEs you targeted.
Step 6: Open the PR, then confirm the CVE is gone from the default branch
"PR merged" is not the same as "CVE fixed". After merge, re-scan the default branch, not the PR branch:
Three things commonly bring a fixed CVE back: another workspace or service in the same repository still pins the old version, a long-lived branch merges an old lockfile over the new one, or a later dependency change pulls the vulnerable version back in transitively. Treat a CVE as closed only when the default branch scan is clean, and keep re-checking it as the branch moves.
Why npm Audit Fix --force Breaks Builds
npm audit fix is a reasonable first move. npm audit fix --force is not, and our demo shows why.
With caret ranges ("handlebars": "^4.7.6", "jsonwebtoken": "^8.5.1"), plain npm audit fix upgraded handlebars from 4.7.6 to 4.7.10, inside the declared range, and left jsonwebtoken alone:
With exact pins ("express": "4.17.1"), plain npm audit fix fixed nothing, and every remaining fix said Will install express@4.22.3, which is outside the stated dependency range.
That is what --force overrides. It installs versions outside the ranges you declared, including new majors like jsonwebtoken 9, applies every upgrade in one diff, and runs none of your tests. It resolves the dependency tree; it does not check whether your code still works with it. When the build breaks, you have one commit containing several unrelated upgrades and no baseline to compare against.
Safer options, in order:
Run
npm audit fixwithout--forceand commit that on its own.Upgrade each remaining package explicitly, one PR per package:
npm install express@4.22.3 --save-exactstays in the 4.x line;npm install jsonwebtoken@9is a major, so do Step 4 first.For a vulnerable transitive dependency whose parent has no fixed release yet, use
overridesinpackage.jsonas a temporary pin, and remove it once the parent catches up:
An override forces a version the parent never tested against, so it needs the same baseline and candidate test run as any other upgrade.
What Today's Vulnerability Remediation Tools Automate, and Where they Stop
Every major vendor now ships some form of automated fix. They differ most in two places: how they pick the target version, and what counts as proof that the fix works.
Tool | What it automates | Verification | Where it stops |
|---|---|---|---|
CodeAnt AI CVE Auto-Fix | All six steps: reachability, lowest fixing version, upgrade impact, environment detection, baseline and candidate checks, PR | Its own clean baseline and candidate runs, then continuous re-verification | npm and pip projects on GitHub today; anything it cannot do safely stops with a stated reason |
Socket fix | CLI that bumps dependencies and updates the manifest and lockfile; npm and pnpm at launch | Optional | Ecosystem coverage started narrow |
Dependabot security updates | PR to the minimum version that includes the patch; can group security updates per ecosystem | Your CI runs on the PR; compatibility scores come from CI results in other public repositories | Outside npm and NuGet, cannot fix a transitive dependency if the parent also needs updating |
Renovate | Security PRs from GitHub alerts ( | Your CI runs on the PR | Treats a security fix like any other update; no reachability or code-usage analysis |
Fix PRs that upgrade vulnerable open source dependencies | Your CI runs on the PR | Merging and confirming the result is up to you | |
GitLab auto-remediation (public beta, July 2026, Ultimate) | MR to the nearest fixed version for Bundler, Maven, Gradle, Python and JS/TS package managers; a Duo agent can commit code fixes for breaking changes | The project pipeline passing | Go and Rust not yet supported; agentic fixes need Duo Agent Platform credits |
Veracode Fix for SCA | PRs covering direct and transitive dependencies, with code updates for breaking upgrades | Your existing CI jobs run on the PR | Supported ecosystems not listed in the announcement |
The pattern across most tools is that steps 1 and 3 are automated, step 4 is partly automated, and steps 5 and 6 are delegated to whatever your CI happens to test. That is a reasonable design if your test suite is strong. If it is not, a green pipeline proves less than it appears to, which is why the question to ask any vendor is: what exactly ran, against which baseline, and how do I know the CVE is gone from main after merge?
The Same Six Steps, Automated in CodeAnt AI
CodeAnt AI's CVE Auto-Fix runs the method above on every connected repository. The screens below come from our own test repositories, including a small Node service pinning handlebars@4.7.6 among other outdated packages, so you can follow a single fix from finding to proof.
Steps 1 and 2: inventory and prioritization
Each scan inventories direct and transitive dependencies from manifests and lockfiles, then runs reachability analysis against your source. In the test repository, 32 vulnerable dependencies were detected and 12 were confirmed reachable from the code; the other 20 were not reachable.
Opening a package shows every advisory with its CVSS score, EPSS probability and its own reachability verdict, so a package can have reachable and unreachable CVEs at the same time. The Dependency path tab shows how the package enters the build and every source file that imports it, which answers the Step 1 question of why the package is present.

The Dependency path tab: the manifest that brings the package in, and the source files that import it
Steps 3 and 4: the lowest fixing version and its upgrade impact
The Recommended fix tab does Step 3 and Step 4 together. For handlebars it found that 4.7.10 resolves all 13 open advisories, a patch release in the same major. It then assessed the upgrade against the code that actually uses the package: it lists the calls (require("handlebars") at src/app.js:2, Handlebars.compile(template) at src/app.js:12), checks them against the API changes between the two versions, reads the release notes, and confirms the new version resolves with the rest of package.json. The verdict states its confidence and the evidence behind it. It is a prediction; the build and tests that prove it come in Step 5.

The Recommended fix tab: one target version for all 13 advisories, and the upgrade impact judged against the APIs this code calls
Step 5: a clean environment that matches the repository
Building baseline and candidate is only meaningful in the right environment. CVE Auto-Fix detects the package manager and runtime per repository, such as npm on Node 20 or 22 and pip on Python 3.10 to 3.12, and lets you correct the detected runtime when it is wrong.

Environment detection per repository: package manager and runtime, with auto-fix status
Step 6: proof, then confirmation on the default branch
Every fix moves through the same stages: fix planned, draft pull request opened, verification passed, open for review, merged, and confirmed gone from main. The verification record shows what ran. For the handlebars fix, both baseline and candidate passed clean, install, clear-report, test and compatibility checks, with 10 tests run, tied to the exact commit tested and the pull request head. Verification is repeated as the branch moves, and the CVE only counts as fixed once it is confirmed gone from the default branch after merge. One pull request also carries every CVE that the same upgrade resolves, so the three reachable handlebars CVEs ship together.

The verification record for a fix pull request: baseline and candidate checks, tests run, and the remaining merged and confirmed-gone stages
The automation also refuses to overstate. In the same repository, fixes for two other packages stopped as drafts with the reason shown, rather than being marked ready for review. A stopped fix with a stated reason is more useful than a green PR that breaks production.
On the CodeAnt Free plan, CVE Auto-Fix opens 10 fix pull requests a month, each verified in your build. Beyond that, each fix pull request uses 5 credits, at $1 per credit.
What It Takes to Automate Fixes Safely: Lessons from Building CVE Auto-Fix
Turning the six steps into a system that opens pull requests on its own turned out to be mostly about the moments where a careful engineer would stop. These are the rules our engineering team built into CVE Auto-Fix. They apply to any remediation automation you build or buy, so use them as questions for vendors too.

Give every finding a stable identity. The same CVE in the same package has to stay one finding when the installed version changes, the commit moves or the advisory gains an alias (a GHSA ID next to the CVE ID). It also has to stay separate across branches, workspace roots and package sources. Without that, every upgrade looks like one finding closed and another opened, and history disappears.
Plan from every advisory range, in the ecosystem's own version rules. The target is the lowest published release that is not yanked or a prerelease, runs on the declared runtime (Python's
requires-python, for example), and clears every active advisory range for the package. npm's semver and Python's PEP 440, with its post-releases and environment markers, compare versions differently, so compare natively rather than as strings. Stay within the current major, and within the current minor for 0.x packages, where a minor release is allowed to break. When the advisory data for one release is inconclusive, such as a CVE record that does not name its package, skip that release and keep searching instead of stopping or guessing. Check the chosen version against a second, independent advisory source before the PR is marked ready.Fix transitive dependencies with the smallest change first. Try a lockfile-only refresh, then compatible upgrades of the direct parents, several together if needed, using the package manager's own resolver. For Python, an exact pin of the child in the requirements file the installer actually reads is another option. Whatever the route, a clean install has to confirm that the vulnerable child version is really gone.
Constrain what the fix can touch. The component that writes the patch has no free shell. It can edit only the planned dependency declarations and the lockfile, which the package manager regenerates rather than anyone hand-editing it, plus caller files found by static analysis of imports, aliases and re-exports when an API change needs a migration. Tests, CI workflows, scripts, secrets and unrelated dependencies are off-limits. Environment markers, extras and comments in requirements files are preserved.
Review the change before a pull request exists. A reviewer model reads the exact proposed diff together with facts it cannot invent: the registry's confirmed metadata for the target release, a deterministic major and minor version comparison, upstream release notes for that version window, and the error handling around every changed call. A required major upgrade, a broad migration or an unresolved correctness risk stops the fix with a reason the owner can read. Review findings stay private, so the pull request that does open is not buried in bot comments.
Treat a green test run as necessary, not sufficient. Baseline and candidate run in disposable environments that match the repository's runtime. A candidate passes only with a clean install; a non-empty, passing JUnit report, because a command that exits 0 after running zero tests proves nothing; the installed dependency graph read back from the environment, proving the planned versions are what actually installed; and advisory coverage for every targeted CVE. The result is a receipt tied to the exact commit and tree that was tested. When the base branch or the PR head moves, the receipt no longer counts.
Probe the behavior your tests do not cover. Thin test suites pass upgrades that change behavior. CVE Auto-Fix generates small compatibility probes from the baseline source, its callers and the existing tests, has them reviewed independently, and runs the same probes against baseline and candidate in a sandbox with no network, no credentials and no root access. A changed result blocks readiness unless it is a justified security or format change.
Publish the way a careful engineer would. There is one pull request per remediation batch, carrying every CVE the same upgrade fixes. It starts as a draft and becomes ready only with a current receipt. Commits are written with an expected-head check, so a lost network response can be recovered without duplicate commits or pull requests, and human edits are never overwritten. The description lists the releases considered and why each was ruled out, the installed versions, the test counts, the tested merge commit and the outcome for each CVE. Auto-merge stays off unless the merge queue itself enforces the verification check.
Close findings on evidence, not on merge. A merged fix waits in a verifying state until a fresh scan of the default branch confirms every occurrence is gone. A fix someone made by hand is recognized and attributed. A partially fixed batch shrinks to what remains, and a vulnerability that comes back reopens the same finding with its history intact.
Say "partial" and "stopped" out loud. When no clean, compatible release exists, a release that removes the targeted CVE and improves the overall severity can be proposed as a draft for explicit owner review, listing the advisories it removes, leaves and introduces. A candidate that leaves a critical or unknown-severity advisory behind is disqualified. Anything that cannot be done safely stops with a stated reason and a recovery action, such as a manual recheck, instead of failing silently.
Where it stops today. CVE Auto-Fix opens fix pull requests for npm and pip projects on GitHub, for direct and transitive dependencies. Dependency scanning and reachability cover more ecosystems and Git hosts than that. Upgrades that need a new major version, unsupported lockfile formats and some private package sources stop with a stated reason rather than a guess.
Common Mistakes and Trade-Offs
Fixing advisories one at a time. Four PRs that each bump the same package to a different version waste review time and can conflict. Group by package and target the lowest version that fixes all of its advisories.
Editing the manifest and forgetting the lockfile. A changed package.json or requirements.in with a stale lockfile means CI installs the old version. Commit the regenerated lockfile in the same PR, and install from it (npm ci, pip install -r on pinned requirements) when you test.
Overriding a transitive version permanently. overrides in npm, resolutions in Yarn, a direct pin in Python, or dependencyManagement in Maven are useful bridges. Left in place, they freeze a version the parent never tested and hide the moment the parent ships a real fix. Add a comment with the reason and a date to revisit.
Auto-merging on green CI with a thin test suite. Auto-merge is reasonable for patch upgrades with a strong suite and a baseline comparison. For majors, or for packages your tests barely exercise, a green pipeline proves little. Keep a human on those.
Treating unreachable as never. An unreachable CVE today can become reachable after the next feature uses the vulnerable function. Deprioritize unreachable findings, but fold them into routine upgrades instead of dismissing them, and re-run reachability as the code changes.
Reporting merged as fixed. The metric that matters to an auditor or a customer is whether the default branch, and what you deploy from it, is still vulnerable. Track "confirmed gone from main", not "PRs merged".
The main trade-off is speed against certainty. Bumping everything at once is fast and produces one large, hard-to-debug change. One package per PR, with a baseline comparison, is slower per fix but makes each failure obvious, which is what lets you automate the remaining ones safely.
Conclusion
Finding vulnerable dependencies takes one command. Fixing them safely takes the six steps in this guide, run in the same order every time.
Inventory what you ship, including transitive dependencies. Prioritize by reachability, EPSS and the KEV catalog. Pick the lowest version that clears every advisory, and stay in the current major when you can.
Predict breakage before you run anything. Build and test baseline against candidate in a clean environment. Then confirm the CVE is gone from the default branch, and keep checking as the branch moves.
Whether you run these steps by hand or automate them, judge every fix PR by its evidence. Ask what ran, against which baseline, and whether the CVE was confirmed gone from main after merge.
For a worked example of remediating a critical CVE end to end, read our PHP2Shell remediation playbook. To compare scanners before you automate, see the best software composition analysis tools.







