Skip to main content
MediumSupply chainOWASP A08:2021CWE-1357

How to fix: Git dependency with no commit pin

A dependency in the exposed manifest resolves from a git source with no commit pin. The value uses git+https, git+ssh, git:// or the github: shorthand, with no 40-character commit hash.

Why it matters

Without a commit pin the install resolves whatever the branch points at when the build runs. Anyone who can push to that branch, a maintainer, a compromised account, or whoever ends up owning the repository if it changes hands, decides what code your next build executes. There is no registry review, no immutable version, and no signature in the path.

Registry packages are immutable once published, which is what makes a version number meaningful. A git reference has no such guarantee: a branch or tag can be force-updated in place, and a deleted repository name can be re-registered by someone else. A commit SHA is the only reference in git that cannot be changed under you, and the resolution has to record it.

How to fix it

  1. 1Replace each git reference with a #<40-hex-commit> pin, or publish the package to a registry and depend on a version.
  2. 2Commit the lockfile so the resolved commit is recorded even when the manifest names a branch.
  3. 3Confirm the repository is one you control or trust, and that it still exists under the account you expect.
  4. 4Run installs with a frozen lockfile in CI (npm ci, not npm install) so an unpinned reference cannot re-resolve silently.

Code examples

Pin the commit

JSON
{
  "dependencies": {
    "internal-utils": "git+https://github.com/example/internal-utils.git#3f2b9c1d5a4e8f70b1c2d3e4f5a6b7c8d9e0f1a2"
  }
}

CI: never re-resolve

bash
npm ci            # installs exactly what package-lock.json records
# not: npm install, which may re-resolve a moving git ref

References

Detected automatically by VulnRadar. The check id is supply-chain-git-dependency-unpinned, stable across every scan so you can filter or diff on it.

See every supply chain check

Questions

How severe is Git dependency with no commit pin?
VulnRadar rates this medium severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id supply-chain-git-dependency-unpinned, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Git dependency with no commit pin map to?
It maps to CWE-1357. In the OWASP Top 10 it falls under A08:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for git dependency with no commit pin

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Git dependency with no commit pin | VulnRadar