-
Notifications
You must be signed in to change notification settings - Fork 186
apm-action: 'apm install' before audit overwrites in-PR file tamper (drift detection blind) #1202
Copy link
Copy link
Closed
Labels
area/audit-policyapm-policy.yml schema, custom_checks, install-time enforcement.apm-policy.yml schema, custom_checks, install-time enforcement.area/ci-cdGitHub workflows, merge queue, gh-aw integrations, release pipeline.GitHub workflows, merge queue, gh-aw integrations, release pipeline.priority/highShips in current or next milestoneShips in current or next milestonestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/securitySecure by default. Content scanning, lockfile integrity, MCP trust boundaries.Secure by default. Content scanning, lockfile integrity, MCP trust boundaries.type/bugSomething does not work as documented.Something does not work as documented.
Metadata
Metadata
Assignees
Labels
area/audit-policyapm-policy.yml schema, custom_checks, install-time enforcement.apm-policy.yml schema, custom_checks, install-time enforcement.area/ci-cdGitHub workflows, merge queue, gh-aw integrations, release pipeline.GitHub workflows, merge queue, gh-aw integrations, release pipeline.priority/highShips in current or next milestoneShips in current or next milestonestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/securitySecure by default. Content scanning, lockfile integrity, MCP trust boundaries.Secure by default. Content scanning, lockfile integrity, MCP trust boundaries.type/bugSomething does not work as documented.Something does not work as documented.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done
Summary
microsoft/apm-action's default behavior runsapm installbefore any audit invocation. When a PR tampers with a deployed managed file (e.g. edits.github/instructions/secure-coding-base.instructions.mdto weaken a security rule),apm installre-deploys the upstream version BEFORE the audit runs, silently overwriting the tamper. Audit then sees the pristine file and passes — even though the PR ships malicious content.Repro
microsoft/apm-action@v1with default settings..github/instructions/or.github/hooks/.apm installoverwrites the tampered file from the upstream plugin source.apm auditruns against the now-pristine file. PASSES.main's history but not in the deployed tree — until someone runsapm installlocally and the PR's edits are silently lost.Either outcome (merge of bad intent into history; or silent loss of the edit) is broken.
Suggested fix
Two options, both better than today:
A. Add
audit-onlymode (recommended). Expose an action input that runs the apm CLI install (so audit can use it) but does NOT re-deploy files. Audit sees the as-committed file state, drift / content-integrity catch the tamper.B. Default behavior change.
apm installin CI should be a no-op whenapm.lock.yamlis present and the deployed file hashes match what's in the lockfile. Tamper is a hash mismatch; re-deploying silently overwriting it is the bug.Workaround (proven)
Wire your own reusable workflow that uses
microsoft/apm-actionwithsetup-only: true(apm CLI on PATH, no install/deploy), then runsapm audit --ci --no-driftdirectly.content-integritycheck then sees the tamper via lockfile hash drift and fails the gate. Working example:DevExpGbb/zava-agent-config/.github/workflows/apm-audit.yml@v5.1.2.Why this matters
Drift detection is the WHOLE POINT of
deployed_file_hashesin the lockfile (https://microsoft.github.io/apm/guides/drift-detection/). The default action behavior makes that detection structurally impossible in CI. Most consumers will use the action by default and assume it audits what's committed. It does not.Context
Discovered while building a 5-beat governance demo for an enterprise pilot. Beat 5 specifically demos a malicious instruction-file edit; surfacing it required moving off the action's default invocation.