Repository navigation
fix(security): pin the full hook bundle in approval fingerprints - #4688
Merged
Daniel Meppiel (danielmeppiel) merged 4 commits intoNov 22, 2026
Merged
Conversation
A hook approval pin now binds the hook document, its referenced scripts, every file the hook bundle copier deploys from those scripts' roots (imported helpers, nested package.json and other assets) and the Node module type they run under. Pins recorded by earlier versions cover less, so each hook approval needs one re-approval. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 20:38
apm-spec-waiver: widens the existing hook approval pin to the deployed hook bundle; no new contract. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical fingerprint gaps leave deployed sibling JSON changes untracked and make approval hashes diverge from installation hashes for materialized helper symlinks.
2 open issues
What changed in this PR
This PR strengthens APM's hook approval checks by expanding fingerprints beyond directly referenced scripts to include bundle assets and Node module type.
Changes:
- Extends hook fingerprints using the shared bundle-file enumerator.
- Adds regression tests for helper and metadata changes, newly added files, and sibling-hook isolation.
- Documents the one-time reapproval required for existing hook pins.
| File | Description |
|---|---|
tests/unit/security/test_trust_admission.py |
Adds bundle fingerprint and sibling-isolation tests. |
src/apm_cli/security/trust_fingerprint.py |
Includes bundle files and module types in hook fingerprints. |
packages/apm-guide/.apm/skills/apm-usage/governance.md |
Updates approval coverage and migration guidance. |
docs/src/content/docs/reference/cli/approve.md |
Describes expanded hook pins and reapproval requirements. |
docs/src/content/docs/consumer/approve-executables.mdx |
Updates consumer guidance on hook approval coverage. |
changelog.d/4688.breaking-changes-and-upgrade-notes.md |
Records the one-time hook reapproval upgrade step. |
Review effort: Balanced
Every hook document a package carries is a document, never a bundle asset, whether or not it is admitted, matching the approval pin. The pin enumerates a source tree as the local package copy lays it out: in-package links are followed under their own names, and a link that leaves the package cannot be pinned. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-hook-bundle-pin
branch
November 22, 2026 08:21
This was referenced Nov 22, 2026
Merged
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (51e2e65, main f53aa79). Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - strict known cells for an MCP entry of a runtime no longer targeted (#4784) and a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Ledger regenerated (baseline 3, known-failing 1, required 2419). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (2e8592d, main acb0423). Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - strict known cells for an MCP entry of a runtime no longer targeted (#4784) and a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Ledger regenerated (baseline 3, known-failing 1, required 2419). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (2e8592d) and merged with main fc1866b. Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - an MCP entry of a runtime no longer targeted (#4784) takes main's required row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Ledger regenerated (baseline 3, known-failing 1, required 2419). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - an MCP entry of a runtime no longer targeted (#4784) takes main's required row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Review folds: I5 admits the compile record only as a regular file and its newly created ancestor directories; run/preview, content-types, plugin-root hook, lane C fresh twin and source-machine bundle identity oracles tightened. Ledger regenerated (baseline 3, known-failing 1, required 2419). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - an MCP entry of a runtime no longer targeted (#4784) takes main's required row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Review folds: I5 admits the compile record only as a regular file and its newly created ancestor directories; run/preview, content-types, plugin-root hook, lane C fresh twin, source-machine bundle identity, self_defined warn and hook bundle update oracles tightened. U-USER-SCOPE-ORG-POLICY removes explicit user-scope cells only: the four scope-free T1 bin x denied-dependency cells are required, witnessed by the project matrix refusals. Ledger regenerated (baseline 3, known-failing 1, required 2423). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - an MCP entry of a runtime no longer targeted (#4784) takes main's required row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Review folds: I5 admits the compile record only as a regular file and its newly created ancestor directories; run/preview, content-types, plugin-root hook, lane C fresh twin, source-machine bundle identity, self_defined warn and hook bundle update oracles tightened; the self_defined warn row is a real warn-mode policy now and is strict known on #5070. U-USER-SCOPE-ORG-POLICY removes explicit user-scope cells only: the four scope-free T1 bin x denied-dependency cells are required, witnessed by the project matrix refusals. Ledger regenerated (baseline 3, known-failing 1, required 2423). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - an MCP entry of a runtime no longer targeted (#4784) takes main's required row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Review folds: I5 admits the compile record only as a regular file and its newly created ancestor directories; run/preview, content-types, plugin-root hook, lane C fresh twin, source-machine bundle identity, self_defined warn and hook bundle update oracles tightened; the self_defined warn row is a real warn-mode policy now and is strict known on #5070; the #4826 refusal row checks rollback. U-USER-SCOPE-ORG-POLICY removes explicit user-scope cells only: the four scope-free T1 bin x denied-dependency cells are required, witnessed by the project matrix refusals. Ledger regenerated (baseline 3, known-failing 1, required 2423). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 23, 2026
…C, v0.38 sweep) Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars: - policy promise rows in test_policy_promises.py with a control each (scripts deny, self_defined, max_depth, require_resolution, source_attribution, unmanaged_files, fail_on_drift, pinned constraint, explicit includes, transitive MCP trust, content types); the #4826 install refusal is required now that #4853 fixed it on main. - an MCP entry of a runtime no longer targeted (#4784) takes main's required row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824). - lane C incremental deploy differential (kit from #4849). - v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged install writes nothing (#4790), hook bundle approval pin (#4688), a registry URL on a local host (#4521). - burndown: a denied local bundle is refused unwritten (#4646), present- provenance-unknown x denied-executable (#4767), audit --ci judges locked content with apm_modules gone, merged-hook entry detection end to end (#4798). Review folds: I5 admits the compile record only as a regular file and its newly created ancestor directories; run/preview, content-types, plugin-root hook, lane C fresh twin, source-machine bundle identity, self_defined warn and hook bundle update oracles tightened; the self_defined warn row is a real warn-mode policy now and is strict known on #5070; the #4826 refusal row checks rollback; no-write stamps add the POSIX change time. U-USER-SCOPE-ORG-POLICY removes explicit user-scope cells only: the four scope-free T1 bin x denied-dependency cells are required, witnessed by the project matrix refusals. Ledger regenerated (baseline 3, known-failing 1, required 2423). Co-authored-by: Copilot App <[email protected]>
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
A hook approval pin (
apm approve) now covers the whole hook bundle that install deploys, not only the hook document and the scripts it names directly.hook_file_fingerprint(security/trust_fingerprint.py) now binds:iter_deployable_hook_bundle_filesenumeration install uses. That includes imported helper modules, nestedpackage.jsonfiles and other assets;_hook_module_type, taken from the nearestpackage.jsontype).Any change to a byte that deploys with an approved hook now shows as "changed since approval" and parks the hook until it is re-approved. Sibling hook documents stay out of each other's pins, because each one is pinned separately.
Upgrade note. Hook pins recorded by earlier versions covered less, so each existing hook approval shows as changed once.
apm installparks the hook,apm audit --cireports the pin mismatch, andapm approve <pkg>re-pins it. This is intentional and fails closed. MCP and native plugin pins are unchanged.Docs:
reference/cli/approve.md,consumer/approve-executables.mdx,apm-usage/governance.md.Issue and approved scope
Issue: none; scope set by the maintainers. Maintainer ruling: pin the full deployed closure; existing hook approvals re-prompt once.
Human scope-approval comment: approved by the maintainers.
Does this PR complete the issue, or what remains? It completes it.
Type of change
Testing
New tests in
tests/unit/security/test_trust_admission.py:test_hook_fingerprint_binds_the_deployed_hook_bundleis parametrized over four changes, each of which must change the pin, while a change to a file outside the bundle must not:package.json,package.jsontype,test_hook_fingerprint_ignores_a_sibling_hook_documentchecks that a sibling hook document is not part of the pin.The four bundle cases fail on main and pass here.
Local runs:
Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedapm-spec-waiver: widens the existing hook approval pin to the deployed hook bundle; no new contract.