Safeguard
Supply Chain•

What should you review in an upstream diff before merging it into a fork?

Before merging upstream into your fork, scan the diff for build scripts, dependency changes, install hooks and hidden characters. A short checklist.

Safeguard Security Team
4 min read

Review the files that can run code or change what you pull in, not every line. Start with build scripts, install hooks, workflow files, dependency manifests, binary files and anything that reaches the network. A sync that you merge without reading is a way for a compromised upstream to reach your product.

Why a sync deserves a review

A fork's sync pulls hundreds of commits from people you do not manage. Normally that is fine. When an upstream account is taken over, a sync is the delivery mechanism. The review is cheap compared with the cost of shipping a poisoned change, and it is one of the few controls a fork owner holds that ordinary dependency users do not, because you see the source before you build it.

Get a readable diff

Compare the old base with the new tag, and start with a summary.

git fetch upstream --tags
git diff --stat OLD_TAG NEW_TAG
git diff --name-only OLD_TAG NEW_TAG

Sort the file list by risk, as in the table, and read the high risk files in full.

File typeWhy it is riskyWhat to look for
Build and packaging scriptsRun on your build machinesNew downloads, shell commands, obfuscation
Install or post install hooksRun on your users' machinesNetwork calls, file writes outside the package
CI workflow filesRun with your tokens if you share themNew triggers, new secrets use, new third party actions
Dependency manifests and lockfilesChange what you pull inNew packages, odd sources, changed versions
Binary or minified filesCannot be reviewed as textWhy are they here, can they be rebuilt
Code that touches the network, files or processesCore of most attacksNew outbound hosts, new exec calls

Check for hidden characters

Source can contain characters that look like nothing but change meaning. See can hidden Unicode characters hide in copied code. A simple search for non printing and bidirectional control characters across the diff is worth running.

Compare to the release notes

A diff that includes large changes the notes never mention is a flag. So is a release that is a single huge commit with a vague message, or a maintainer you do not recognize landing build changes. None of these proves an attack, but each is a reason to ask upstream before merging. See signature checks before a sync.

Run, do not just read

  1. Build in an isolated environment with no secrets.
  2. Run the test suite, including your own tests for carried patches.
  3. Rescan dependencies and compare with the previous SBOM. New transitive packages are the thing to spot.
  4. Watch for changes in build behavior, such as new network traffic during the build.

Scale the effort

For a small, routine sync, a fifteen minute pass over the risky files is reasonable. For a large jump after a long gap, split the review by release so each piece is small enough to understand. This is another reason to sync often. See how often to sync a fork.

Where Safeguard fits

Safeguard's policies and gates can run on a pull request that carries the sync, checking the dependency changes it brings. Try a free scan at gold.safeguard.sh/scan.

Try it yourself

Click through it at your own pace, or open it full screen. Look at how a pull request is held until its checks pass.

Quick check

Do I need to read every changed line?

Not usually. Read the files that run code or change dependencies, and skim the rest. Split very large syncs by release.

What is the strongest warning sign?

Changes to build or install scripts that the release notes do not mention, especially from an unfamiliar contributor.

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.