Add policy-aware audits - #1225
Open
ericmj wants to merge 3 commits into
Open
Conversation
ericmj
marked this pull request as ready for review
August 16, 2026 01:10
maennchen
approved these changes
Aug 17, 2026
maennchen
left a comment
Member
There was a problem hiding this comment.
I'll do a manual test round, but the code looks great.
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.
Consumes the override protocol from hexpm/specifications#78 and hexpm/hex_core#215. Adds scoped advisory, retirement, and cooldown overrides, optional comments on every override type, policy-aware audit modes, separate policy/project suppression reporting, SARIF explanations, policy CLI output, and locked-dependency warning filtering.
Dependency resolution
mix deps.getandmix deps.updateenforce the active policy while resolving dependencies. Allow and Deny overrides, advisory and retirement restrictions, cooldowns, and their scoped overrides determine which candidate releases the solver may select.The warning pass then checks dependencies emitted by that resolution rather than scanning the entire lockfile. Matching Allow, advisory, and retirement overrides suppress only their accepted warnings, and project
ignore_advisoriesandignore_retirementsentries remain additive. Policy thresholds do not suppress these post-resolution warnings;mix hex.audit --policyperforms that full policy evaluation.For a policy that overrides
CVE-2026-4242but notCVE-2026-4243, the matching advisory is omitted while the other advisory still warns:Auditing
mix hex.auditalways checks every locked Hex dependency. Its modes differ only in how the active policy classifies advisory and retirement findings:mix hex.auditmix hex.audit --policy-overridesmix hex.audit --policyBoth policy modes require an active policy. Policy-accepted and project-ignored findings appear in separate sections and do not affect the exit code.
Given a High advisory overridden with the comment
The affected parser is disabledand a separate Low advisory under a High policy threshold,--policy-overridesleaves the Low advisory active because no explicit override matches it:--policyalso accepts the Low advisory because it is below the policy threshold:The compatibility fixture confirms older Hex clients ignore unsupported override actions and remain restrictive. Updated clients warn about unsupported actions, ignore those overrides, and continue enforcing the remaining policy.
Validated with
mix format --check-formatted, focused policy tests, command-output reproductions, and the full test suite.