# sarif

URL: /kida/api/utils/sarif/
Section: utils
Description: SARIF (Static Analysis Results Interchange Format) to dict converter.

Stdlib-only converter for SARIF v2.1.0 JSON files. Handles output from
CodeQL, ESLint, Semgrep, Trivy, and other SARIF-producing tools.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/utils/sarif/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Futils%2Fsarif%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Futils%2Fsarif%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Futils%2Fsarif%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Futils%2Fsarif%2Findex.txt)

Module

#
`utils.sarif`

SARIF (Static Analysis Results Interchange Format) to dict converter.

Stdlib-only converter for SARIF v2.1.0 JSON files. Handles output from
CodeQL, ESLint, Semgrep, Trivy, and other SARIF-producing tools.

3Classes1Function

## Classes

`SARIFSummary`

4

▼

Aggregate counts by severity level.

Aggregate counts by severity level.

#### Attributes

Name
Type
Description

`total`

`int`

—

`errors`

`int`

—

`warnings`

`int`

—

`notes`

`int`

—

`SARIFResult`

5

▼

A single static analysis finding.

A single static analysis finding.

#### Attributes

Name
Type
Description

`rule_id`

`str`

—

`level`

`str`

—

`message`

`str`

—

`file`

`str`

—

`line`

`int`

—

`SARIFReport`

4

▼

Top-level SARIF parse result.

Top-level SARIF parse result.

#### Attributes

Name
Type
Description

`tool`

`str`

—

`version`

`str`

—

`summary`

`SARIFSummary`

—

`results`

`list[SARIFResult]`

—

## Functions

`sarif_to_dict`

1

`SARIFReport`

▼

Parse a SARIF JSON file and return a normalized dict.

`def sarif_to_dict(path: str | Path) -> SARIFReport`

##### Parameters

Name
Type
Description

`path`
`str | Path`

Path to the SARIF JSON file.

##### Returns

`SARIFReport`
