Skip to content

fix(security): pin the full hook bundle in approval fingerprints - #4688

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-hook-bundle-pin
Nov 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-hook-bundle-pin

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • the hook document;
  • every script the document references;
  • every file the hook bundle copier deploys from those scripts' source roots, through the same iter_deployable_hook_bundle_files enumeration install uses. That includes imported helper modules, nested package.json files and other assets;
  • the Node module type each root runs under (_hook_module_type, taken from the nearest package.json type).

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 install parks the hook, apm audit --ci reports the pin mismatch, and apm 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

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

New tests in tests/unit/security/test_trust_admission.py:

  • test_hook_fingerprint_binds_the_deployed_hook_bundle is parametrized over four changes, each of which must change the pin, while a change to a file outside the bundle must not:
    • an imported helper,
    • a nested package.json,
    • the package root package.json type,
    • a newly added helper.
  • test_hook_fingerprint_ignores_a_sibling_hook_document checks that a sibling hook document is not part of the pin.

The four bundle cases fail on main and pass here.

Local runs:

  • Unit (security, install, policy, integration, commands, core): 11763 passed.
  • Hook approval integration lifecycles: 192 passed.
  • Lint contract, lifecycle generator and quality baselines: green.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- widens what an existing hook approval pin covers; no new contract.

apm-spec-waiver: widens the existing hook approval pin to the deployed hook bundle; no new contract.

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]>
Copilot AI balanced review requested due to automatic review settings 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]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit c37e8e2 into main Nov 22, 2026
64 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-hook-bundle-pin branch November 22, 2026 08:21
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-integration Run the full integration suite (ci-integration.yml) on this PR before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants