Safeguard
Developer Tools•

How do you check an AI-suggested dependency upgrade before merging?

An assistant says upgrade to version X. Six checks to run first: the version exists, the fix is real, breaking changes, transitive effects and tests.

Safeguard Security Team
3 min read

Verify that the suggested version exists, that the advisory says it fixes your issue, what breaking changes it introduces, what else changes in the lockfile, and that tests cover the code that uses the package. The assistant's confidence is not evidence for any of these.

Why the suggestion needs checking

OWASP's misinformation entry notes that models can suggest non-existent libraries and that attackers can publish malicious packages under commonly hallucinated names. The same weakness applies to versions: a model can name a release that was never published, or one that does not contain the fix.

The six checks

  1. Does the version exist? Look it up on the registry page, not in the model's answer. Check the publish date and the maintainer.
  2. Does it fix the issue? Open the advisory and confirm the fixed version range. Do not rely on the model's summary of it.
  3. What does the changelog say? Scan release notes for removed APIs, changed defaults and minimum runtime versions. A major version bump deserves a longer look.
  4. What else moved? Run the install in a branch and read the lockfile diff. A single upgrade can pull in new transitive packages.
  5. Do tests cover the usage? Search your code for calls into the package. If no test exercises them, add one before upgrading.
  6. Rescan. Confirm the finding is gone and that no new advisories were introduced by the transitive changes.

Reading the lockfile diff

What you seeWhat to do
Only the target package changedGood, proceed with tests
Several packages changedCheck each new version exists and its advisories
A new package appearedCheck what it is and why it is needed
A package was removedConfirm nothing in your code depended on it
Integrity hashes changed unexpectedlyStop and investigate

Install commands

Use the lockfile based install command your ecosystem offers in CI, so builds use exactly what was reviewed. An assistant told to run install commands on its own can alter the lockfile in ways nobody reviewed. See npm ci vs npm install for AI-generated changes.

When there is no fixed version

Sometimes the answer is not an upgrade. Options include pinning to a patched fork you have reviewed, removing the feature that uses the vulnerable function, or adding a compensating control with an expiry date. Ask the assistant to list options, then decide with the code owner.

Record the outcome

Put the registry link, advisory link and test result in the pull request. It takes a minute and saves the next reviewer from repeating it.

Where Safeguard fits

Safeguard scans dependencies and can open fix pull requests, which are off by default with every category on Manual, then rescans the change. Try a free scan at https://gold.safeguard.sh/scan.

Quick check

Is a patch version bump always safe?

Usually lower risk, but not guaranteed. Still read the diff and run tests.

Should the assistant run the install itself?

Prefer that a person or CI runs it from the reviewed lockfile, so changes are visible before they land.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.