Langsung ke konten
Skillpedia
Keamanan8.0k ยท #12708

sarif-parsing

Fungsinya

Skill ini membantu agen membuka dan membersihkan berkas hasil yang dihasilkan pemindai keamanan. Skill ini untuk developer dan staf keamanan yang perlu memahami laporan pemindaian yang besar.

Kapan dipakai

  • โœ“Saat Anda punya berkas SARIF dari pemindai dan ingin tahu isinya.
  • โœ“Saat Anda menjalankan beberapa pemindai dan ingin hasilnya digabung tanpa duplikat.
  • โœ“Saat Anda ingin menyaring output pemindaian dan memasukkannya ke build atau dasbor.

Link skill

https://github.com/trailofbits/skills/blob/main/plugins/static-analysis/skills/sarif-parsing/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/trailofbits/skills/blob/main/plugins/static-analysis/skills/sarif-parsing/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya punya berkas SARIF dari pemindai kami. Bisa Anda hapus peringatan duplikat dan tampilkan hanya yang berisiko tinggi?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agen membaca struktur berkas hasil, mengelompokkan temuan berdasarkan aturan dan lokasi, serta menghapus entri yang berulang. Skill ini juga bisa mengonversi output ke format lain. Skill ini tidak menjalankan pemindaian sendiri.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

SARIF Parsing Best Practices

You are a SARIF parsing expert. Your role is to help users effectively read, analyze, and process SARIF files from static analysis tools.

When to Use

Use this skill when:

  • Reading or interpreting static analysis scan results in SARIF format
  • Aggregating findings from multiple security tools
  • Deduplicating or filtering security alerts
  • Extracting specific vulnerabilities from SARIF files
  • Integrating SARIF data into CI/CD pipelines
  • Converting SARIF output to other formats

When NOT to Use

Do NOT use this skill for:

  • Running static analysis scans (use CodeQL or Semgrep skills instead)
  • Writing CodeQL or Semgrep rules (use their respective skills)
  • Analyzing source code directly (SARIF is for processing existing scan results)
  • Triaging findings without SARIF input (use variant-analysis or audit skills)

SARIF Structure Overview

SARIF 2.1.0 is the current OASIS standard. Every SARIF file has this hierarchical structure:

sarifLog
โ”œโ”€โ”€ version: "2.1.0"
โ”œโ”€โ”€ $schema: (optional, enables IDE validation)
โ””โ”€โ”€ runs[] (array of analysis runs)
    โ”œโ”€โ”€ tool
    โ”‚   โ”œโ”€โ”€ driver
    โ”‚   โ”‚   โ”œโ”€โ”€ name (required)
    โ”‚   โ”‚   โ”œโ”€โ”€ version
    โ”‚   โ”‚   โ””โ”€โ”€ rules[] (rule definitions)
    โ”‚   โ””โ”€โ”€ extensions[] (plugins)
    โ”œโ”€โ”€ results[] (findings)
    โ”‚   โ”œโ”€โ”€ ruleId
    โ”‚   โ”œโ”€โ”€ ruleIndex (index into tool.driver.rules[])
    โ”‚   โ”œโ”€โ”€ level (OPTIONAL, inherited from the rule when absent)
    โ”‚   โ”œโ”€โ”€ message.text
    โ”‚   โ”œโ”€โ”€ locations[]
    โ”‚   โ”‚   โ””โ”€โ”€ physicalLocation
    โ”‚   โ”‚       โ”œโ”€โ”€ artifactLocation.uri
    โ”‚   โ”‚       โ””โ”€โ”€ region (startLine, startColumn, etc.)
    โ”‚   โ”œโ”€โ”€ fingerprints{}
    โ”‚   โ””โ”€โ”€ partialFingerprints{}
    โ””โ”€โ”€ artifacts[] (scanned files metadata)

Severity Is Not Always on the Result

result.level is optional. CodeQL omits it on every result and records severity on the rule as defaultConfiguration.level, which the result inherits. Read result.level directly and a CodeQL run scores as clean however many errors it found, which is how a severity gate ends up exiting 0 on a failing repo.

Resolve severity in this order (SARIF 2.1.0 section 3.27.10):

  1. kind other than "fail" (a pass/notApplicable record), so "none"
  2. result.level, when present
  3. the matched rule's defaultConfiguration.level, joining ruleIndex into runs[].tool.driver.rules[], or matching ruleId against rules[].id when the tool omits ruleIndex
  4. "warning", the SARIF default

Every severity query in this skill starts from that resolution. In jq it is the LEVEL_FN definition in {baseDir}/resources/jq-queries.md; in Python it is resolve_level(result, run) in {baseDir}/resources/sarif_helpers.py.

Why Fingerprinting Matters

Without stable fingerprints, you can't track findings across runs:

  • Baseline comparison: "Is this a new finding or did we see it before?"
  • Regression detection: "Did this PR introduce new vulnerabilities?"
  • Suppression: "Ignore this known false positive in future runs"

Tools report different paths (/path/to/project/ vs /github/workspace/), so path-based matching fails. Fingerprints hash the content (code snippet, rule ID, relative location) to create stable identifiers regardless of environment.

Tool Selection Guide

Use Case Tool Install / run
Quick CLI queries jq brew install jq / apt install jq
Python scripting (simple) pysarif uv run --with pysarif python script.py
Python scripting (advanced) sarif-tools uv run --with sarif-tools python script.py
.NET applications SARIF SDK NuGet package
JavaScript/Node.js sarif-js npm package
Go applications garif go get github.com/chavacava/garif
Validation SARIF Validator sarifweb.azurewebsites.net

Strategy 1: Quick Analysis with jq

For rapid exploration and one-off queries:

# Pretty print the file
jq '.' results.sarif

# Count total findings
jq '[.runs[].results[]] | length' results.sarif

# List all rule IDs triggered
jq '[.runs[].results[].ruleId] | unique' results.sarif

# Severity resolution, needed by every query below that filters on level.
# See resources/jq-queries.md for the annotated version.
LEVEL_FN='
  def rule($run):
    . as $r
    | ($run.tool.driver.rules // []) as $rules
    | (if ($r.ruleIndex | type) == "number" and $r.ruleIndex >= 0
       then $rules
Pertanyaan umum

Apakah skill ini menjalankan pemindaian keamanan?

Tidak. Skill ini hanya memproses hasil yang sudah ada, jadi Anda butuh pemindaian terlebih dahulu.

Bisakah menggabungkan hasil dari alat yang berbeda?

Bisa. Skill ini bisa menggabungkan temuan dari beberapa alat keamanan menjadi satu daftar.

Bisakah dipakai dalam pipeline otomatis?

Bisa. Skill ini mencakup cara menambahkan pemrosesan SARIF ke sistem CI dan CD.

Detail

Deskripsi asli dari pembuat

Parses and processes SARIF files from static analysis tools like CodeQL, Semgrep, or other scanners. Triggers on "parse sarif", "read scan results", "aggregate findings", "deduplicate alerts", or "process sarif output". Handles filtering, deduplication, format conversion, and CI/CD integration of SARIF data. Does NOT run scans โ€” use the Semgrep or CodeQL skills for that.

repo: trailofbits/skills

Popularitas

Bintang GitHub
8.0k
Peringkat
#12708
Lisensi
CC-BY-SA-4.0
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa