Skip to content

Report DENY overrides on locked packages in mix hex.audit - #1243

Merged
ericmj merged 1 commit into
mainfrom
audit-policy-deny
Sep 22, 2026
Merged

ericmj merged 1 commit into
mainfrom
audit-policy-deny

Conversation

@ericmj

@ericmj ericmj commented Sep 21, 2026

Copy link
Copy Markdown
Member

mix hex.audit --policy and mix hex.audit --policy-overrides only walked registry retirements and advisories, so a locked package matched by a DENY override with neither never appeared and the audit exited 0.

Both policy modes now scan the lock for packages matched by a final DENY override, list them in a "Denied:" section, print "Found packages denied by the active policy", and exit 1. ignore_advisories and ignore_retirements don't apply to denials, since they're keyed by advisory ID or retirement and a denied package stays a violation until the policy changes. Default mode without a policy flag is unchanged.

SARIF output gets a HEX0006 PolicyDenied rule at level error with the override comment in the message. Hex.Policy.Filter.acceptance_message/1 returns "Denied by the active dependency policy." for a deny without a comment, which also fixes the "denied by override: Accepted by the active dependency policy." line that mix hex.policy why printed.

The mix deps.get warning pass still doesn't mention locked packages matched by a DENY override. That's the deps.get side of the same gap and belongs with the lock enforcement discussed in #1186.

The policy audit modes only walked registry retirements and advisories,
so a locked package matched by a DENY override with neither never
appeared and the audit exited 0.

Both --policy and --policy-overrides now scan the lock for packages
matched by a final DENY override, list them in a "Denied:" section, and
exit 1. Project ignores don't apply to denials. SARIF output gains the
HEX0006 PolicyDenied rule, and acceptance_message/1 returns a deny
specific message for overrides without a comment.
@ericmj
ericmj added this pull request to stack #1245 September 22, 2026 10:48
@ericmj
ericmj marked this pull request as ready for review September 22, 2026 12:33
@ericmj
ericmj merged commit 46bea0d into main Sep 22, 2026
22 checks passed
@ericmj
ericmj deleted the audit-policy-deny branch September 22, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant