Repository navigation
fix(approve): accept the content-bound local-bundle key install prints (#4437) - #4490
Conversation
apm-spec-waiver: local-bundle approval record is CLI-internal; no OpenAPM-observable behaviour change. Co-authored-by: Copilot App <[email protected]>
…before fix) Co-authored-by: Copilot App <[email protected]>
#4437) apm approve <key> matches the key against the bundle the last install recorded and writes the same executables.allow grant; a wrong, stale or uninstalled content binding is refused (exit 1, [x]) before any write. The install record now keeps every installed bundle's key, not only parked ones. apm approve --pending prints a runnable approve command per parked bundle. apm-spec-waiver: local-bundle approval record is CLI-internal; no OpenAPM-observable behaviour change. Co-authored-by: Copilot App <[email protected]>
df69dc8 to
e20abf8
Compare
|
Fails-before evidence for
The tree at |
|
Binary provenance for the red/green run above: APM_BINARY_PATH was this worktree's own The red on the parent is the "not found" refusal, not a version-stamp or edited-lock refusal. Failing assertion at |
…4464/#4490/#4494/#4498 Co-authored-by: Copilot App <[email protected]>
…apm approve command
One remedy, one message: a parked local-bundle executable prints the
catalog entry local-bundle-executables-unapproved, 'apm approve <key>'
('-g' at user scope), then the reinstall, with the executables.allow entry
as the same grant. The executed-remedy test runs the printed approve
command and reinstalls; it needs apm approve for content-bound keys (#4490).
Co-authored-by: Copilot App <[email protected]>
…mmit Keep #4490's record shape (key plus declared types, approve by recorded key); add #4505's commit-only persistence as BundleRecordStage. Co-authored-by: Copilot App <[email protected]>
Fixes #4437 (scope record: #4437 (comment))
Description
apm approvenow accepts the content-bound local-bundle key thatapm install <bundle>prints (name#version@sha256:<digest>). It approves the bundle's executables by writing the sameexecutables.allowgrant the install diagnostic tells you to add, so both paths are equivalent. There is one store and one owner for the decision:install/local_bundle_pending.pyis the single record of installed local bundles. It now keeps every installed bundle's exact key and executable types, not only the parked ones.--pendingstill re-checks trust, so approved bundles stay hidden. The newrecorded_bundle(key)is the only lookup.commands/approve.pysplits content-bound keys out before spec canonicalization._resolve_bundle_keysrefuses any key that no install recorded (wrong digest, or the bundle bytes changed since the key was printed): exit 1, an[x]line, nothing written._approve_bundleswritesallow[key] = {type: true}through_save_store(theexecutables.allowwriter) and clears a same-store deny. It reports[x]and exits 1 if another layer still denies the key.apm approve --pendingprints a runnableapm approve [-g] '<key>'per parked bundle, rendered by thesecurity/trust.approve_commandowner (architecture ruleinstall-deployment-approve-commandis clean).reference/cli/approve.mdgains a "Local bundles" section, and the apm-usagecommands.mdnow saysapm approve "<key>"works, withexecutables.allowkept as the equivalent path. This supersedes the docs: local bundle executables are approved in apm.yml executables.allow #4463 line saying approve does not accept bundle keys.Issue and approved scope
Issue: Fixes #4437
Human scope-approval comment: #4437 (comment)
This PR completes the issue. Out of scope, per the record: new key formats beyond the printed one.
Type of change
Testing
603b31efa97c6eb4cd0d69af90eacac01cc1cdaf(test only, on train c8dbec8): RED expected and observed.e20abf85ecdcb672a240e56e9a9667ab47d7a124(fix, docs, ledger, CHANGELOG): GREEN.New lifecycle test:
tests/integration/test_local_bundle_hooks_lifecycle.py::test_approve_grants_the_printed_local_bundle_key(installed CLI,lifecycle_smoke). It covers:executables: {}: hooks are parked and the key is printed.[x]line, project tree bytes unchanged.apm approve <printed key>writes exactlyexecutables.allow: {key: {hooks: true}}. Rerunning the install registers the hook and runs it, the lock matches disk, and--pendingis clean.Expected red on the parent:
apm approve <key>exits 1 with "not found" at the first approve step. The test also refuses a wrong-digest key, a key for a bundle that isn't installed, and a stale key (project tree and$APM_HOME/config.jsonbyte-identical), and runs the exactapm approve '<key>'line--pendingprints.Red/green evidence (
.venv/bin/python -m pytest tests/integration/test_local_bundle_hooks_lifecycle.py::test_approve_grants_the_printed_local_bundle_key -n 1 -p no:cacheprovider -q, APM_BINARY_PATH=.venv/bin/apm):1 failed--AssertionError: assert '[x]hookpkg#1.0.0@sha256:000...:noinstalledlocalbundlehasthisexactcontent' in 'hookpkg#1.0.0@sha256:000...:notfoundininstalledpackages.Review:apmapprove--pending'(approve has no local-bundle key path).1 passed in 58.94s.Lint run locally:
uvx [email protected] checkandformat --checkon the touched files,scripts/lint-auth-signals.sh,check_complexity_ratchet.py --base-ref origin/train/0.37-final(clean),lint_architecture_boundaries.py --root .(clean).Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)