Safeguard
Developer Tools•

Should you fork or patch a dependency when upstream is slow?

Decision guide for when upstream is slow to fix a dependency: wait, override, patch, fork, or replace, with owners, costs and exit conditions for each.

Safeguard Security Team
4 min read

Fork only when waiting is unacceptable, no safe override exists, and your team can maintain the fork. Otherwise prefer a temporary override, a vendored patch with a pull request upstream, or a replacement. Every option needs an owner and an exit condition, or it becomes permanent by accident.

The options in order of weight

OptionWhat it isCostTypical owner
WaitAccept risk until upstream releasesLowest effort, risk staysService team, with exception record
OverrideForce another existing versionLow, but may break compatibilityOwner of the root build
Patch upstreamSubmit a fix and use it when mergedMedium, depends on maintainersThe team that needs it
Source level patchPoint to a patched source copyMedium to highOwner of the build
ForkMaintain your own copy long termHigh, ongoingA named team
ReplaceSwitch to a different libraryHigh upfrontService team

Several ecosystems support source level patching directly. Cargo's patch section lets you put a fixed version of a crate in place of the original, and its documentation describes this for testing a bugfix or preparing a change that is not yet released. Go's replace directive replaces the contents of a specific version of a module, or all versions, with contents found elsewhere, including a local path.

Questions to ask in order

  1. Is there a released fix? If yes, upgrade or override. A fork is a bad answer to a problem upstream already solved.
  2. Is the risk reachable? If the vulnerable path is not called, waiting with an exception may be the cheapest safe choice.
  3. Is the upstream maintained? Look at recent activity and open pull requests, not guesses. A silent project argues for replacing it.
  4. Can we submit the fix upstream? A patch that gets merged turns your cost into a shared cost.
  5. Who will maintain the fork? If you cannot name a team and a budget, do not fork.

What changes when you fork

You take on security monitoring for that code, because scanners and advisories track the original package name and version. You also inherit release work, license obligations and the job of merging upstream changes. Document these duties in the decision record.

Scanning gets more complicated too. A patched or forked package may report a different name or version than the advisory data expects, and tools can disagree on whether it is fixed. Record how you verified the fix, so a later scan result does not restart the dispute.

Exit conditions

Write them at the start:

  • Upstream releases a version that includes the fix, and tests pass: remove the patch.
  • The patch has been open upstream for an agreed period without a response: revisit replacing the library.
  • The fork's maintainer team changes: reassign or retire.

Put the review date on a calendar, not in a document nobody reads.

Try it yourself

Click through it at your own pace, or open it full screen. Notice which findings already have a fixed version available, since those should never need a fork.

Quick check

Is a vendored copy the same as a fork?

Close. A vendored copy lives inside your repository and you carry any local changes. Treat it like a fork for ownership and monitoring purposes.

Can we use an override instead of a fork?

If a released version fixes the problem and works with your code, yes. An override forces an existing version. A fork is for when no suitable release exists.

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.