Report DENY overrides on locked packages in mix hex.audit - #1243
Merged
Merged
Conversation
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
added this pull request to stack #1245
September 22, 2026 10:48
ericmj
marked this pull request as ready for review
September 22, 2026 12:33
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.
mix hex.audit --policyandmix hex.audit --policy-overridesonly 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_advisoriesandignore_retirementsdon'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
HEX0006PolicyDeniedrule at level error with the override comment in the message.Hex.Policy.Filter.acceptance_message/1returns "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 thatmix hex.policy whyprinted.The
mix deps.getwarning 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.