Manifest & Lockfile Configuration Drift
Detected an integrity mismatch between the declared manifest specifications and the resolved lockfile tree. Deterministic build guarantees are compromised, risking phantom deployments and unverified runtime behavior.
Overview
Modern build ecosystems separate dependency management into two distinct layers:
- The Manifest (
package.json,pyproject.toml,.csproj,composer.json,go.mod): Defines developer intent and loose SemVer constraints. - The Lockfile (
package-lock.json,poetry.lock,packages.lock.json,composer.lock,go.sum): Freezes the exact immutable resolution graph with cryptographic checksums.
The KEVLAR-CONFIG-DRIFT rule triggers when a direct dependency in the manifest is missing from the lockfile, points to an incompatible version, or has drifted due to manual editing, git merge conflicts, or incomplete package manager invocations.
"dependencies": {
"lodash": "^4.17.21"
}
"node_modules/lodash": {
"version": "4.17.15" // Vulnerable!
}
Risk & Impact Analysis
Allowing manifest and lockfile drift breaks foundational assumptions in software engineering and security operations:
Developers pulling code experience unpredictable compilation failures, mismatched dependency versions, and untraceable bugs that can't be reproduced on other machines.
A developer updates package.json to patch a high-severity CVE, but forgets to regenerate the lockfile. Production continues to build the vulnerable legacy package.
Hardened CI/CD systems executing deterministic install commands (such as npm ci, poetry install --frozen) fail abruptly, blocking hotfix releases.
Without synchronized lockfile hash verification, environments that fall back to dynamic resolution are vulnerable to package squatting and dependency confusion attacks.
How Kevlar Detects It
Kevlar CheckDeps executes a hermetic topological check across project configuration files:
-
1
Manifest Declaration Extraction: Parses all direct, dev, and peer dependency requirements and SemVer ranges specified in root manifests.
-
2
Lockfile Tree Cross-Validation: Verifies that every declared requirement has an exact matching node in the lockfile satisfying the requested version constraint.
-
3
Integrity & Missing File Check: Asserts that the lockfile exists on disk and is under version control. If drift or constraint violations are detected, Kevlar raises an
errorlevel SARIF finding with dual physical locations.
Example SARIF v2.1.0 result emitted by Kevlar:
{
"ruleId": "KEVLAR-CONFIG-DRIFT",
"level": "error",
"message": {
"text": "Config drift detected: 'package.json' requires 'lodash@^4.17.21' but 'package-lock.json' resolved '4.17.15'. Deterministic build compromised."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": { "uri": "package.json" },
"region": { "startLine": 16, "endLine": 16 }
}
}
],
"relatedLocations": [
{
"id": 1,
"physicalLocation": {
"artifactLocation": { "uri": "package-lock.json" },
"region": { "startLine": 342, "endLine": 345 }
},
"message": { "text": "Mismatched resolved lockfile node" }
}
],
"properties": {
"package": "lodash",
"manifestConstraint": "^4.17.21",
"lockfileResolved": "4.17.15",
"precision": "very-high"
}
}
Remediation Guide by Ecosystem
Resolve configuration drift by synchronizing your lockfile with manifest intent, then enforce strict frozen checks in your CI/CD pipeline.
1. Re-synchronize package-lock.json without redownloading all node_modules:
npm install --package-lock-only
2. In CI/CD pipelines, always use npm ci to strictly enforce zero drift:
# Fails immediately if package.json and package-lock.json diverge npm ci
3. For Yarn and pnpm users:
# Yarn Berry (v2 - v4) yarn install --immutable # pnpm pnpm install --frozen-lockfile
1. Re-lock poetry.lock to reflect pyproject.toml without upgrading other packages:
poetry lock --no-update
2. In CI/CD pipelines, enforce frozen lockfile consistency:
poetry check poetry install --sync
3. When using pip-tools with requirements.txt:
pip-compile --generate-hashes pyproject.toml -o requirements.txt
1. Ensure lockfile generation is enabled in your .csproj or Directory.Build.props:
<PropertyGroup> <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> </PropertyGroup>
2. Force re-evaluation and update packages.lock.json:
dotnet restore --force-evaluate
3. Enforce locked-mode verification in CI workflows:
dotnet restore --locked-mode
1. Re-generate composer.lock to match composer.json without bumping version numbers:
composer update --lock
2. Validate configuration synchronization in CI pipelines:
composer validate --strict composer install --prefer-dist --no-progress
1. Re-synchronize go.mod and go.sum with imported code packages:
go mod tidy
2. Verify module integrity and ensure read-only build behavior in CI:
go mod verify go build -mod=readonly ./...
Suppression & Policy Configuration
Configuration drift represents an acute build integrity flaw and should rarely be suppressed. However, during complex monorepo migrations or emergency hotfixes where a lockfile regeneration is queued in a parallel branch, you can establish a short-lived waiver in kevlar-suppressions.json:
KEVLAR-CONFIG-DRIFT should always specify an immediate expiration (maximum 72 hours) and include direct references to the tracking Pull Request that repairs the synchronization.
{
"version": "1.0",
"suppressions": [
{
"ruleId": "KEVLAR-CONFIG-DRIFT",
"package": "lodash",
"reason": "Emergency hotfix deployment. Lockfile regeneration queued in PR #814.",
"approvedBy": "[email protected]",
"expiresAt": "2026-10-02T12:00:00Z",
"ticketUrl": "https://github.com/company/repo/pull/814"
}
]
}