Skip to content

feat: add SARIF 2.1.0 output format for GitHub Advanced Security integration - #1

Merged
obielin merged 3 commits into
mainfrom
copilot/add-sarif-output-format
Jul 11, 2026
Merged

feat: add SARIF 2.1.0 output format for GitHub Advanced Security integration#1
obielin merged 3 commits into
mainfrom
copilot/add-sarif-output-format

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Adds --format sarif to the CLI so skillguard findings can be uploaded to the GitHub Security tab as code-scanning alerts.

New: src/skillguard/sarif.py

  • results_to_sarif(results: list[SkillScanResult]) -> dict — core converter
  • report_to_sarif(report: BatchScanReport) -> dict — batch convenience wrapper
  • to_sarif_string(results, indent=2) -> str — JSON serialisation helper
  • All 12 rules emitted as SARIF reportingDescriptor entries in tool.driver.rules
  • Severity → SARIF level: CRITICAL/HIGHerror, MEDIUMwarning, LOWnote, INFOnone
  • Each finding produces a result with ruleId, ruleIndex, level, message.text, and locations[].physicalLocation (uri + startLine)
  • Windows backslash paths normalised to forward slashes

CLI (src/skillguard/cli.py)

  • --format choices extended: text | json | sarif
  • SARIF branch added for both single-file and directory scan paths

Usage

# Single file
skillguard scan SKILL.md --format sarif > results.sarif

# Directory
skillguard scan ./skills/ --format sarif > results.sarif

GitHub Actions upload:

- name: Scan skills
  run: skillguard scan ./skills/ --format sarif > skillguard.sarif

- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: skillguard.sarif
    category: skillguard

Tests (tests/test_sarif.py)

37 tests covering: SARIF schema/version fields, rule descriptor completeness, result fields, multi-skill batches, URI normalisation, and CLI subprocess output.

README

Output formats section updated; new SARIF sub-section with the Actions snippet above; roadmap item marked complete.

Copilot AI changed the title feat: add SARIF 2.1.0 output format and --format sarif CLI flag feat: add SARIF 2.1.0 output format for GitHub Advanced Security integration Jul 11, 2026
Copilot AI requested a review from obielin July 11, 2026 13:49
@obielin
obielin requested review from Copilot and obielin and removed request for Copilot and obielin July 11, 2026 14:04
@obielin
obielin requested review from Copilot and removed request for Copilot July 11, 2026 14:05
@obielin
obielin marked this pull request as ready for review July 11, 2026 14:15
@obielin
obielin merged commit 3825721 into main Jul 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants