Repository navigation
fix(audit): name locked entries without a content hash under the default policy - #4495
Merged
Daniel Meppiel (danielmeppiel) merged 16 commits intoNov 21, 2026
Merged
Conversation
…' into danielmeppiel-cache-integrity-parity-4356
…pdate The audit --ci replay reads locked git sources through the same persistent cache as install, --frozen and update (attach_persistent_git_cache), so both commands recompute content_hash over the same bytes and reach one verdict. A re-fetch of an existing apm_modules copy is staged with the install transaction, so a refused install leaves apm_modules as it was. update reports a refusal through the [x] error line. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… probes and ledger Adds the install-deployment-locked-source-cache closed-world guard and its mutation case, installed-CLI paired audit --ci / install --frozen probes and an update refusal probe, ledger rows and a CHANGELOG line. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ntegrity-parity-4356
…omission cell to #4389 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The audit --ci replay attaches the persistent git cache read-only: it serves an existing checkout for the locked commit and never creates, evicts or records cache entries; any miss falls back to a fresh clone. Updates the integrate re-download unit test for the staged copy. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
A nested copy staged before its parent no longer occupies the parent's backup path; both staging orders roll back byte for byte. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…lay cache Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… re-fetch A content hash refusal can only reject a row that records content_hash, so only those copies are staged with the install transaction; rows without one re-fetch in place as before. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…names unhashed rows Under require_hashes both readers refuse and name the row; by default both accept it alike. The dependency-content-hashes audit check names the rows. apm-spec-waiver: aligns which local package copy install, --frozen, update and audit --ci read; req-lk-015 refusal and diagnostic unchanged Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ult policy (#4453) Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 19:47
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new hash-enforcement diagnostic includes raw repository URLs, exposing embedded credentials in audit output and JSON/SARIF reports.
4 open issues
What changed in this PR
Adds an apm audit --ci advisory naming locked dependencies without content hashes under the default policy, addressing #4453. The diff also includes the stacked #4385 changes that align locked-source verification across audit, install, and update.
Changes:
- Adds an integrity-owner advisory on stderr without intentionally changing exit codes or structured stdout.
- Shares persistent Git-cache attachment and stages existing package copies for rollback after refused installs.
- Extends lifecycle coverage, architecture guards, and regression records.
| File | Description |
|---|---|
tests/unit/scripts/test_architecture_runner.py |
Registers the new guard in the expected inventory. |
tests/unit/install/test_resolution_staging_relocate.py |
Tests nested-copy staging and rollback order. |
tests/unit/install/test_integrate_orchestration.py |
Checks restoration of staged package bytes. |
tests/quality/generated_obligations.json |
Updates integrity regression coverage mappings. |
tests/lifecycle/security/test_integrity.py |
Makes repaired integrity cases required checks. |
tests/integration/test_trust_integrity_consistency_lifecycle.py |
Tests missing-hash policy behavior and the advisory. |
tests/integration/test_mcp_omission_lifecycle.py |
Updates the expected-failure issue reference. |
tests/integration/test_locked_source_cache_parity_lifecycle.py |
Adds cross-command integrity and rollback tests. |
tests/integration/test_architecture_owner_rule_mutations.py |
Tests detection of missing replay-cache wiring. |
tests/fixtures/lifecycle_bug_ledger.json |
Records fixes and their regression tests. |
src/apm_cli/policy/policy_checks.py |
Names entries missing required hashes. |
src/apm_cli/install/transaction.py |
Adds staging before replacement of locked copies. |
src/apm_cli/install/sources.py |
Stages existing copies before sequential downloads. |
src/apm_cli/install/resolution_staging.py |
Uses isolated backup slots for nested packages. |
src/apm_cli/install/phases/resolve.py |
Uses shared cache attachment. |
src/apm_cli/install/phases/integrate.py |
Stages mismatched copies instead of deleting them. |
src/apm_cli/install/phases/download.py |
Stages copies before parallel downloads. |
src/apm_cli/install/integrity.py |
Owns the missing-content-hash advisory. |
src/apm_cli/install/drift.py |
Attaches the cache for read-only audit replay. |
src/apm_cli/commands/update.py |
Routes installation failures through error logging. |
src/apm_cli/commands/outdated.py |
Reuses shared cache attachment. |
src/apm_cli/commands/audit.py |
Emits the missing-hash advisory on stderr. |
src/apm_cli/cache/paths.py |
Supports resolving cache paths without creating them. |
src/apm_cli/cache/git_cache.py |
Adds read-only lookup and shared attachment. |
scripts/architecture_linter/checks/install_locked_source_cache.py |
Guards cache ownership and staging call sites. |
scripts/architecture_linter/checks/install_deployment_analyzers.py |
Registers the locked-source cache guard. |
CHANGELOG.md |
Documents the advisory and stacked integrity fixes. |
.apm/architecture/owners/install-deployment.json |
Records shared cache and staging ownership. |
Review effort: Balanced
Comment on lines
+1404
to
+1407
| names = ", ".join( | ||
| sorted( | ||
| dep.repo_url for dep in unhashed_dependencies(lockfile.get_package_dependencies()) | ||
| ) |
| checkout_dir.is_dir() | ||
| and verify_checkout_sha(checkout_dir, sha.lower()) | ||
| and _checkout_has_materialization_pins(checkout_dir) | ||
| and _sparse_checkout_is_complete(checkout_dir, sparse_paths, env=env) |
| ) | ||
| ) | ||
|
|
||
| _warn_unhashed_dependencies(cfg.project_root, fetch_result) |
| ) | ||
| ) | ||
| return ( | ||
| f"Locked dependencies without a content hash, verified by commit only: {names}. " |
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…hash under the default policy Co-authored-by: Copilot App <[email protected]> # Conflicts: # src/apm_cli/commands/audit.py # tests/fixtures/lifecycle_bug_ledger.json
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>
…advisory fires (#4453) The integrity advisory goes to stderr; Click 8.2's result.output merges both streams, so the JSON cell now parses result.stdout and asserts the advisory on stderr, and a SARIF cell pins the same contract. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…; audit reads the lockfile guarded (#4469 x #4495) (04daadaf) Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-s22-hashless-advisory
branch
November 21, 2026 05:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Stacked on #4385; integrate after it.
When policy does not require content hashes (the default
security.integrity.require_hashes: false),apm audit --ciaccepted locked git and registry entries without acontent_hashbut never named them. It now prints one[!]advisory on stderr. The advisory names those entries as verified by commit only and points atsecurity.integrity.require_hashes: true. The exit code and stdout (JSON, SARIF) are unchanged. The wording lives at the integrity owner (install/integrity.unhashed_dependencies_advisory). Withrequire_hasheson, the existing fail-closed check names the rows instead, so the message is never printed twice.Issue and approved scope
Issue: Fixes #4453
Human scope-approval comment: see #4453.
Does this PR complete the issue, or what remains? It completes it.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
tests/integration/test_trust_integrity_consistency_lifecycle.py::test_frozen_and_audit_agree_on_a_git_row_without_content_hash_by_default(installed CLI) now also asserts exactly one advisory naming the row and the knob. It fails before the change (no advisory) and passes after. The pairedrequire_hashestest still passes.Ledger test, ruff check and format, architecture boundaries, the complexity ratchet and the auth-signal lint are clean.
Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)