Repository navigation
Description
Summary
When a child policy declares extends: org but does NOT redeclare an unmanaged_files: block, the merged policy's unmanaged_files.action is silently downgraded to the model's default (ignore) instead of inheriting the parent's deny.
The _escalate(_UNMANAGED_ACTION_LEVELS, parent.action, child.action) call at src/apm_cli/policy/inheritance.py:198 correctly takes the max, but the child.unmanaged_files for a child that omits the block is not "no opinion" — it's UnmanagedFilesPolicy(action='ignore', directories=()). So max('deny', 'ignore') == 'deny' should hold but the resulting merged check reports as disabled.
Repro
org/.github/apm-policy.yml:
name: org
version: "1.0.0"
enforcement: block
unmanaged_files:
action: deny
directories:
- .github/instructions
- .github/agents
- .github/hooksrepo/apm-policy.yml:
name: child
version: "1.0.0"
extends: org
enforcement: block
dependencies:
deny:
- "**/some-pattern"
# (no unmanaged_files block)Add an unmanaged file (e.g. .github/hooks/sneaky.hook.md) and run:
apm audit --ci --policy ./apm-policy.ymlExpected: unmanaged-files check fails with action deny inherited from org.
Actual: [+] unmanaged-files | Unmanaged files check disabled (action: ignore) and the audit passes.
Workaround
Redeclare the unmanaged_files block in every override that should preserve the parent's posture:
extends: org
unmanaged_files:
action: deny
directories:
- .github/agents
- .github/instructions
- .github/hooksThis loses the value proposition of extends: (single source of truth at the org root) — the override has to mirror the parent's directory list verbatim, which is exactly what the inheritance feature is supposed to avoid.
Suggested fix
Two routes:
- Make the model field on
UnmanagedFilesPolicydistinguish "default" from "explicitly set". A child that did NOT declareunmanaged_files:should be treated as transparent in_merge_unmanaged_files, returningparentunchanged. (Mirrors how_intersect_allowtreatsNoneas "no opinion".) - Or: at parse time, propagate parent values into any child block fields the child did not explicitly set, before invoking the merge.
The first is cleaner because it matches the rest of the inheritance.py contract.
Affected versions
Reproduced with apm v0.x (current main). Same logic at src/apm_cli/policy/inheritance.py:194-200.
Impact
Org-wide governance posture silently weakens whenever a team adds a repo override for an unrelated policy area (e.g. extra dependency deny patterns). Hard to detect — apm audit --policy org shows the right floor, but apm audit --policy ./apm-policy.yml (which the consumer typically runs in CI for layered enforcement) silently ignores the floor for unmanaged_files.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon May 9, 2026
Triage decision
accept
Proposed labels
Milestone
0.12.5 (recommended; unable to apply programmatically -- milestone number not resolvable without authenticated CLI)
Suggested next action
Fix
UnmanagedFilesPolicyininheritance.pyto distinguish an omittedunmanaged_files:block (transparent -- inherit parent) from an explicitly setaction: ignore(override), mirroring how_intersect_allowtreatsNoneas "no opinion."Suggested issue comment
Per-lens notes (collapsed)
DevX UX Expert -- User-Need Reviewer
The
extends: orgmechanism is positioned as the single-source-of-truth governance primitive -- a repo override should inherit every parent field unless it explicitly overrides it. The silent downgrade ofunmanaged_files: action: denytoignorebreaks this contract: a team adding an unrelated deny pattern for dependencies now unwittingly removes the org's unmanaged-file floor. This is exactly the failure modeextends:is meant to prevent. The mental model is clear and the bug is well-scoped.Supply Chain Security Expert -- Risk-Surface Reviewer
unmanaged_files: action: denyis APM's primary guardrail against unauthorized content in.github/instructions/,.github/agents/, and.github/hooks/. A silent downgrade at the inheritance merge step means org-level policy can be quietly eroded by any repo that adds an override for an unrelated dimension. The affected surfaces arearea/audit-policy(the policy engine merge logic) andarea/content-security(the governance directories the check protects).theme/governanceis required.OSS Growth Hacker -- Contributor-Tone Reviewer
Not activated -- danielmeppiel is a COLLABORATOR with extensive prior interactions; tone adjustment for a new contributor is not needed.
Python Architect -- Architecture Reviewer
The fix is feasible and narrowly scoped to
inheritance.py. Route 1 (Optional/sentinel semantics onUnmanagedFilesPolicy.action) is cleaner than Route 2 (pre-propagation at parse time) because it localizes the "no opinion" concept to the merge layer, matching the existing_intersect_allowpattern. Cross-cutting impact: the YAML parser forUnmanagedFilesPolicymust emitNone(or a sentinel) when the block is absent, rather than constructing the default instance. Any callers that assumeactionis always a string will need a null-guard. The scope is narrow enough forstatus/acceptedwithout a prior design doc.Doc Writer -- Documentation Reviewer
Not activated -- the fix is an internal inheritance merge logic change with no new user-facing CLI surface. The existing policy reference page already documents the intended
extends:behavior; no new pages are required. A brief note in CHANGELOG.md about the bug fix is sufficient.APM CEO -- Triage Arbiter
This is a confirmed, reproducible governance regression with a clear fix path and no design ambiguity. The silent downgrade of a security-enforcing policy field is exactly the kind of quiet failure that erodes trust in the governance layer. Accepting at
priority/highfor the 0.12.5 patch. The Python Architect's Route 1 recommendation aligns with the existing codebase conventions; no design doc needed. The fix for #1198 and #1201 likely lives in the same PR since they share the same root cause.{ "decision": "accept", "decision_detail": "", "theme": "theme/governance", "areas": ["area/audit-policy", "area/content-security"], "type": "type/bug", "status": "status/accepted", "priority": "priority/high", "preserved_labels": [], "milestone": "0.12.5", "next_action": "Fix UnmanagedFilesPolicy in inheritance.py to treat an absent unmanaged_files block as transparent (inherit parent), not as action: ignore.", "comment_markdown": "Thanks for the detailed repro and the two proposed fix routes -- this is a confirmed bug in the policy inheritance merge logic.\n\nThe root cause is that `UnmanagedFilesPolicy(action='ignore', directories=())` is the Python default for an omitted `unmanaged_files:` block, and the merge code cannot distinguish \"child said nothing\" from \"child explicitly set action: ignore.\" So the escalation call never has a chance to win.\n\n**Accepted.** Route 1 (make the field sentinel-aware -- treat a missing block as \"no opinion\" and return parent unchanged) is the right fix. It mirrors the pattern `_intersect_allow` already uses for allow-list fields and avoids requiring callers to redeclare the entire parent block.\n\nThe fix lives in `src/apm_cli/policy/inheritance.py` around lines 194-200. Any place that constructs `UnmanagedFilesPolicy` from YAML input (the parser) will also need to distinguish \"key absent\" from \"key present with value ignore.\"\n\nTarget: 0.12.5 patch. If you would like to send a PR, that would be very welcome -- the fix is narrowly scoped and the test harness for `inheritance.py` is solid. A regression test reproducing the org+child fixture from this report would make a good addition.\n\nSee the governance policy reference for the documented behavior: (microsoft.github.io/redacted) }Note
🔒 Integrity filter blocked 12 items
The following items were blocked because they don't meet the GitHub integrity level.
search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter:fix: policy inheritance treats absent unmanaged_files as transparent (#…
fix: policy inheritance preserves parent unmanaged_files when child o…
fix: policy inheritance preserves parent unmanaged_files when child o…