Repository navigation
feat(policy): judge local bundles against dependencies.allow by their recorded packages - #4677
Closed
Daniel Meppiel (danielmeppiel) wants to merge 5 commits into
Closed
Daniel Meppiel (danielmeppiel) wants to merge 5 commits into
Daniel Meppiel (danielmeppiel) wants to merge 5 commits into
Conversation
Base automatically changed from
danielmeppiel-bundle-pack-gate-coverage
to
main
November 22, 2026 08:21
… recorded packages (#4646) dependencies.allow matches only the packages a local bundle's embedded lockfile records, with the remote-dependency matcher; it never matches the author-chosen _local/<name>. Under an allow list a bundle that records no package is refused before any write. dependencies.deny still matches the bundle name and its packages. Co-authored-by: Copilot App <[email protected]>
… allow (#4646) apm-spec-waiver: local bundle install applies the existing dependencies.allow matcher (req-pl-005, req-pl-018) to the packages its embedded lockfile records; the spec does not define local bundle admission, so no new contract. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-p1-4646-bundle-allow-policy
branch
from
November 22, 2026 08:46
b183a19 to
a1efbde
Compare
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 22, 2026 09:02
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 22, 2026 09:02
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The release notes lack migration guidance for newly blocked bundles, and the documentation incorrectly implies allow lists prevent writes regardless of enforcement mode.
2 open issues
What changed in this PR
Extends local bundle admission to evaluate dependencies.allow against embedded lockfile packages, building on the existing deny-policy checks from #4645.
Changes:
- Checks recorded packages against the allow list, excluding author-chosen bundle names; blocking policies reject bundles with no recorded packages.
- Preserves deny checks for both bundle names and packages, and keeps pack behavior unchanged.
- Adds component and installed-CLI coverage, remediation guidance, and policy documentation.
| File | Description |
|---|---|
tests/unit/install/test_bundle_policy_subjects.py |
Tests package-based admission, empty bundles, and deny compatibility. |
tests/unit/core/test_remediation_w2_bundle_catalog.py |
Records evidence for the new remediation hint. |
tests/quality/lifecycle_obligations.json |
Updates a source evidence line reference. |
tests/lifecycle/world/test_world.py |
Adds expected results for the allow-list policy variant. |
tests/lifecycle/world/services.py |
Defines the allow-list policy fixture. |
tests/lifecycle/generator/rules.py |
Updates the preflight evidence anchor. |
tests/integration/test_org_dependency_allow_local_bundle_lifecycle.py |
Exercises bundle admission and unchanged state after refusals. |
src/apm_cli/policy/policy_checks.py |
Applies allow checks to bundled packages and handles empty bundles. |
src/apm_cli/policy/models.py |
Separates bundle names from recorded package identities. |
src/apm_cli/policy/install_preflight.py |
Accepts the structured bundle policy subjects. |
src/apm_cli/install/bundle_admission.py |
Collects and forwards bundle names and packages separately. |
src/apm_cli/core/remediation.py |
Adds guidance for bundles without recorded packages. |
packages/apm-guide/.apm/skills/apm-usage/governance.md |
Documents local bundle allow-list behavior. |
docs/src/content/docs/reference/policy-schema.md |
Explains package-based allow matching. |
docs/src/content/docs/reference/cli/install.md |
Describes bundle allow-list admission. |
docs/src/content/docs/enterprise/apm-policy.mdx |
Adds local bundle policy guidance. |
changelog.d/4677.added.md |
Announces local bundle allow-list enforcement. |
Review effort: Balanced
…te changelog (#4677) Co-authored-by: Copilot App <[email protected]>
…-bundle-allow-policy # Conflicts: # tests/lifecycle/world/services.py
Merged
6 of 14 tasks
Collaborator
Author
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 22, 2026
Merge main f4efa6b and fold #4730 and #4769 (bundle allow-list policy from #4677) into the [0.38.0] block. Co-authored-by: Copilot App <[email protected]>
Merged
3 of 10 tasks
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
TL;DR. Under an org
dependencies.allowlist (refusal withenforcement: block;warnreports),apm install <bundle>now judges a local bundle by the packages its embeddedapm.lock.yamlrecords — never by the author-chosen bundle name_local/<name>— and refuses, before any write, a bundle that records no packages.dependencies.denykeeps matching both the bundle name and its packages. With no allow list, bundle installs are unchanged.Fixes #4646
Note
Dependency order: none. Builds on the local bundle dependency policy (#4645, merged); rebased onto
main.Design decision (scope authority)
Regent v3 ruling, 2026-11-21 18:30, relayed by the 0.38 program manager:
Problem (WHY)
apm install <bundle>never consulteddependencies.allow: an org that allow-lists its sources could still receive any content through a local bundle.allowon it would let any bundle pass by naming itself after an allowed package.Approach (WHAT) and implementation (HOW)
policy/models.pyLocalBundleSubjects(names, packages): the bundle name(s) as_local/<name>and the packages its lockfile records.install/bundle_admission.pybundle_policy_subjectsreturnsLocalBundleSubjects;admit_bundlepasses it on. Same owner and call path as #4645 (admit_bundle→run_policy_preflight→policy_checks).policy/policy_checks.py_check_dependency_allowlistjudgesbundle.packages(same matcher as remote deps) and adds a fail-closed subject when a bundle records none;_check_dependency_denylistgetsnames + packages. Shared iteration factored into_declared_then_bundled.policy/install_preflight.pyLocalBundleSubjects.core/remediation.pybundle-packages-unrecordedentry:Run 'apm install <package>' to install the content from a package the allow list names.enterprise/apm-policy.mdx,reference/policy-schema.md,reference/cli/install.md,apm-usage/governance.md.allow-listpolicy variant in the lifecycle world.apm unpackandapm packare unchanged (pack stays deny-only per #4645).Trade-offs
allow(rejected: name-or-packages). The author picks the name, so allowing on it is a bypass.Benefits
Issue and approved scope
Issue: Fixes #4646
Human scope-approval comment: pending — an
apm-scoperecord has been requested from Intake. Scope authority meanwhile is the Regent v3 ruling quoted above.Does this PR complete the issue? Yes: decision documented, behaviour implemented, allow-listed and not-allow-listed bundles tested.
Type of change
Testing
Scenario evidence
test_bundle_whose_packages_the_allow_list_names_is_admitted; lifecycle stepinstall <allowed bundle>exit 0, lockfile records ittest_bundle_package_outside_the_allow_list_is_refused; lifecyclemixedbundle exit 1, state unchangedtest_bundle_recording_no_package_is_refused_under_an_allow_list; lifecyclep-execbundle exit 1, state unchangedtest_bundle_named_like_an_allowed_package_is_judged_by_its_packages; lifecycle bundle namedp-skillembeddingp-exectest_deny_still_matches_the_bundle_name_under_an_allow_list; #4645test_denied_local_bundle_is_refused_before_any_writestill greentest_bundle_recording_no_package_is_admitted_without_an_allow_listapm install <allowed package>after the empty-bundle refusal, exit 0Lifecycle test:
tests/integration/test_org_dependency_allow_local_bundle_lifecycle.py(installed CLI, policy ON, snapshot oracle).Failing-before: with
src/reverted to the pre-change code, the lifecycle test fails at the empty-bundle step (exit=0,assert 0 == 1); passing after.Validation commands and results
How to test
dependencies.allow: ["**/p-skill"], runapm install <bundle>for a bundle whose lockfile records onlyp-skill: installs.p-skillrecordingp-exec: exit 1,Policy violation: github.com/<org>/p-exec -- not in allowed sources, nothing written.the bundle records no packages for dependencies.allow to match.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}regenerateddependencies.allowmatcher (req-pl-005, req-pl-018) to a local bundle's recorded packages; the spec does not define local bundle admission. Waiver carried in thetest(policy): remediation proof level ...commit.Co-authored-by: Copilot [email protected]