[BUG] apm approve <key> for a bundle saves the grant, then exits 1 when another trust layer still denies it

Open
#4,933 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@danielmeppiel is already working on this.

Since Nov 23, 2026.

  • #4934 by @danielmeppiel — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
cli, security

Research direction

Start in src/apm_cli/commands/approve.py, the bundle-only path where the grant is written before the remaining denial from another trust layer is reported. Use the ordering fix in PR #4928 (refuse before writing apm.yml) as the pattern to follow, and check which approval state is saved before the exit. Done when a bundle-only approve that is still denied exits 1 with the same message and leaves the approvals and apm.yml bytes unchanged, shown by a test that fails before the change.

Written by the indexing model from the issue text.

Description

bug status/accepted type/bug

Summary

apm approve <key> for a local bundle saves the approval and only then exits 1 with "still denied by another trust layer". A failed command changes durable state, which breaks invariant I7 (a failed command changes nothing).

Details

#4923 (PR #4928) makes apm approve refuse an org-denied package before writing apm.yml. The bundle-only path in src/apm_cli/commands/approve.py has the same ordering problem: it records the grant, then reports the remaining denial from another trust layer.

Expected

When another trust layer will still deny the item, apm approve <key> refuses before any write: exit 1, the same message, and approvals and apm.yml bytes unchanged.

Acceptance

A failing-before cell: a bundle-only approve that is still denied by another layer exits 1 and leaves the approvals and apm.yml bytes unchanged.

Source: out-of-scope finding while fixing #4923 (PR #4928).

Dominant language
Python
Stars
4.4k
Forks
430
Avg merge
19h 38m
Merged PRs (30d)
637

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/apm

All issues in microsoft/apm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.