The SARIF emitter writes a schema-validated SARIF 2.1.0 file that any code-scanning UI can consume. Source:Documentation Index
Fetch the complete documentation index at: https://docs.agentguardian.io/llms.txt
Use this file to discover all available pages before exploring further.
reports/sarif.py
- the bundled schema at
reports/sarif-2.1.0.schema.json.
When to use this page
- You’re wiring AgentGuardian into a GitHub Actions workflow and need the SARIF to upload to the Security tab.
- You’re feeding a Sonar / SemGrep-style aggregator that already consumes SARIF from other scanners.
- You want per-finding inline annotations on the PR’s Files changed view.
Generate one
ReportError rather than landing on disk silently broken.
The SARIF shape
Oneruns[] entry per scan. Each run carries one tool.driver (the
AgentGuardian metadata), one rules[] entry per triggered probe,
and one results[] entry per finding.
How severity maps
SARIF only has three levels (error, warning, note). AgentGuardian
has four (critical, high, medium, low). The mapping folds
critical + high into error and the four-tier value goes into
properties.aivss_severity for downstream tools that want the full
resolution.
| AgentGuardian severity | SARIF level | properties.aivss_severity |
|---|---|---|
critical | error | "critical" |
high | error | "high" |
medium | warning | "medium" |
low | note | "low" |
error distinct from warning distinct from note. The
aivss_severity property is what lets a custom dashboard re-split
error into critical vs high.
The mapping triple inside SARIF
Every finding carries the same OWASP / MITRE / CSA triple as the JSON emitter — propagated throughproperties so a SARIF consumer can
group findings by ASI without ever loading the JSON:
| SARIF location | JSON equivalent | Notes |
|---|---|---|
rules[].properties.asi | findings[].asi | The probe’s static mapping. |
results[].properties.asi | findings[].asi | The per-finding mapping (always equal to the probe’s). |
rules[].properties.mitre_atlas | findings[].mitre_atlas | Multiple entries — numeric AML.T* + named techniques. |
results[].properties.csa | findings[].csa_category | The CSA Agentic Risk bucket. |
Redaction
The SARIF emitter routes every finding through the sharedredact_finding helper before serialisation — same scrubbing the
JSON emitter applies. message.text, properties.trigger_prompt (if
present), and any embedded transcripts are scrubbed of PII and
credential shapes (OpenAI / AWS / GitHub / Google keys, JWTs, bearer
tokens, password= assignments).
This is not a knob. A security scanner must never re-emit a captured
secret into a SARIF that gets uploaded to a public PR.
Schema validation
The SARIF emitter validates against the bundled SARIF 2.1.0 schema before writing the file. A schema violation raisesReportError
with the offending JSON Pointer.
The bundled schema is the published draft from
oasis-tcs/sarif-spec.
This catches the failure modes a downstream consumer (GHAS, Sonar)
would silently reject:
- Missing required
version,runs[],tool.driver.name. - A
results[].ruleIdthat doesn’t match anyrules[].id. - An out-of-enum
levelvalue.
Uploading to GitHub Code Scanning
The official action handles the upload — see Upload SARIF to GitHub for the full walk-through. The minimal shape:- Your job needs
permissions: security-events: writeat the workflow or job level. - Use
if: always()so a failed--fail-undergate still uploads the SARIF — otherwise reviewers lose the annotations on the PR that needs them most.
Anti-patterns
Next step
Upload SARIF to GitHub
The
github/codeql-action/upload-sarif@v3 walk-through.GitHub Actions
The full workflow that produces + uploads the SARIF.
JSON export
The signed canonical artifact every other emitter is derived from.
Report schema
Field-by-field reference for the JSON + SARIF outputs.