TMA-SUPPLY-CHAIN-LOCKFILE
Ensure a dependency lockfile is committed for each detected package ecosystem
Beschreibung
Lockfiles pin the exact (and, for most ecosystems, hash-verified) versions of direct and transitive dependencies so builds are reproducible and a newly published malicious version is not pulled in silently. The audit inspects package manifests at the repository root (npm/yarn/pnpm/bun, Go, Cargo, Bundler, Composer, Pipenv, Python pyproject, Gradle, SwiftPM, Dart, Mix) and requires the matching lockfile to be tracked by git. Passes with a note when no supported manifest exists. Run tmaegis from inside the repository; the audit fails when git is missing or the working directory is not a git repository.
So wird geprüft
Prüfmethode: Shell-Befehl
top=$(git rev-parse --show-toplevel 2>/dev/null) || exit 1
cd "$top" || exit 1
files=$(git ls-files 2>/dev/null) || exit 1
missing=
found=0
chk() {
if printf '%s\n' "$files" | grep -qxE "$1"; then
found=1
printf '%s\n' "$files" | grep -qxE "$2" || missing="$missing $3"
fi
}
chk 'package\.json' '(package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?)' npm
chk 'go\.mod' 'go\.sum' go
chk 'Cargo\.toml' 'Cargo\.lock' cargo
chk 'Gemfile' 'Gemfile\.lock' bundler
chk 'composer\.json' 'composer\.lock' composer
chk 'Pipfile' 'Pipfile\.lock' pipenv
chk 'pyproject\.toml' '(poetry\.lock|uv\.lock|pdm\.lock|pylock(\.[^/]+)?\.toml|Pipfile\.lock)' python
chk 'build\.gradle(\.kts)?' '(gradle\.lockfile|gradle/dependency-locks/.*\.lockfile)' gradle
chk 'Package\.swift' 'Package\.resolved' swiftpm
chk 'pubspec\.yaml' 'pubspec\.lock' dart
chk 'mix\.exs' 'mix\.lock' mix
if [ -n "$missing" ]; then
echo "no committed lockfile for:$missing"
elif [ "$found" -eq 0 ]; then
echo compliant
echo "no supported package manifest at the repository root"
else
echo compliant
fi- Erwartete Ausgabe
compliant
So wird behoben
Behebungsmethode: Anleitung oder Infrastruktur-Patch
Generate and commit the lockfile: npm install --package-lock-only / yarn install / pnpm install; go mod tidy (go.sum); cargo generate-lockfile; bundle lock; composer update --lock; pipenv lock; poetry lock or uv lock; gradle dependencies --write-locks. Use frozen installs in CI (npm ci, yarn --immutable, pip --require-hashes).
Eigenschaften
- Betriebssysteme
- Beliebig
- Tags
- supply-chaindependencieslockfile
- Referenz
- CIS Software Supply Chain Security Guide Benchmark v1.0.0 - Dependencies - pin and lock third-party dependencies (verify section number for your release)
Diesen Host prüfen
Führen Sie dies auf einem Rechner aus, den Sie prüfen dürfen. Der Scan ist schreibgeschützt.
tmaegis scan --target supply-chain