Skip to content

Commit 70abe4d

Browse files
maennchenericmj
authored andcommitted
Add SARIF output format to mix hex.audit
Add a --format sarif option that renders the audit result as a SARIF v2.1.0 document, plus an --output PATH option to write it to a file instead of stdout. This allows uploading audit findings to GitHub code scanning and other SARIF consumers; the moduledoc documents a complete GitHub Actions workflow using github/codeql-action/upload-sarif. Retirements map to one rule per retirement reason (HEX0001 to HEX0005, with security retirements defaulting to level error) and advisories map to one rule per advisory identifier so each alert carries its own severity score, title and help link. Results are anchored to the dependency entry in mix.lock, relative to the git repository root when available, with region and context region snippets. The run includes git-derived version control provenance (with credentials stripped from the repository URL), stable partial fingerprints, and messages that carry both resolved text and template arguments. Ignored findings are included with a suppression so they show up as closed alerts. The exit code behaves the same as with the human format. SARIF output requires the OTP 27 :json module, matching mix hex.outdated --json.
1 parent 29b5731 commit 70abe4d

4 files changed

Lines changed: 930 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Enhancements
66

77
* Print warnings to standard error instead of standard output, keeping stdout clean for machine-readable output such as `mix hex.outdated --json`. Warning-colored lines that are part of a command's regular output, such as retirement notices in `mix hex.info` and the `mix deps.get` dependency listing, remain on standard output
8+
* Add `--format sarif` and `--output PATH` options to `mix hex.audit` to render the audit result as a SARIF v2.1.0 document that can be uploaded to GitHub code scanning and other SARIF consumers. Findings are anchored to the dependency's `mix.lock` entry and ignored findings are included as suppressed results. Requires OTP 27 or later
89

910
## v2.5.1 (2026-07-09)
1011

0 commit comments

Comments
 (0)