Prerequisites
- GitHub repository with Actions enabled
- GitHub Advanced Security (required for private repos; free for public repos)
- qai v0.5.1 or later
Basic Workflow
Create.github/workflows/qai-security.yml:
How It Works
- The workflow installs qai and runs
audit scanwith--format sarif - The SARIF file contains findings mapped to rules (one per scanner category) with severity levels
upload-sarifpushes results to GitHub Code Scanning- Findings appear in the repository’s Security > Code scanning alerts tab
What Shows Up in GitHub
Each qai finding becomes a Code Scanning alert with:- Rule ID — Scanner rule identifier (e.g.,
QAI-INJ-CWE-078-shell_injection) - Severity — Mapped from qai severity: CRITICAL/HIGH →
error, MEDIUM →warning, LOW/INFO →note - Security severity score — Numeric score for GitHub’s severity ranking (9.0 for critical, 7.0 for high, 4.0 for medium)
- Description — Full finding description with evidence
- Properties — Category, tool name, evidence, remediation, and mitigation data
Scanning Specific Checks
Use--checks to run only specific scanners in CI for faster, focused scans:
Branch Protection
Block merges when high-severity findings are detected:- Go to Settings > Branches > Branch protection rules
- Enable Require status checks to pass before merging
- Add the MCP Security Audit job as a required check
The
upload-sarif action does not fail the workflow based on alert severity — it only errors on upload or validation failures. To block merges on findings, add an explicit CI gate step in the MCP Security Audit job that parses the SARIF output and exits non-zero when findings exceed your severity/threshold policy. Branch protection requires the named status check to pass, but blocking on finding severity requires this custom gate.Managing Alerts
In the Security tab, each alert supports:- Open — Active finding, needs attention
- Fixed — Resolved in a subsequent scan (GitHub detects automatically)
- Dismissed — Manually closed with a reason (false positive, won’t fix, used in tests)
Troubleshooting
Results not appearing: Verify the workflow hassecurity-events: write permission. Check the Actions log for upload errors. Allow ~30 seconds for the Security tab to update after upload.
SARIF validation errors: Validate the file before upload: python -m json.tool results.sarif > /dev/null
See Also
- SARIF Export — SARIF format details and severity mapping
- Audit CLI — Full scan command reference
- DefectDojo Integration — Alternative vulnerability management platform