Skip to content

Commit f3d692a

Browse files
authored
Merge pull request #14635 from paulOsinski/sarif-docs
update sarif documentation
2 parents a3aa91e + 04e7232 commit f3d692a

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

  • docs/content/supported_tools/parsers/file

docs/content/supported_tools/parsers/file/sarif.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,38 @@ OASIS Static Analysis Results Interchange Format (SARIF). SARIF is
66
supported by many tools. More details about the format here:
77
<https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sarif>
88

9-
SARIF parser customizes the Test_Type with data from the report.
10-
For example, a report with `Dockle` as a driver name will produce a Test with a Test_Type named `Dockle Scan (SARIF)`
9+
Current implementation will aggregate all the findings in the SARIF file into a single report.
1110

12-
Current implementation is limited and will aggregate all the findings in the SARIF file in one single report.
11+
## How Test Types Are Determined
1312

14-
##### Support for de-duplication (fingerprinting)
13+
Unlike most parsers in DefectDojo, the SARIF parser has a **report-defined Test Type**. When you import a SARIF file with `scan_type=SARIF`, DefectDojo reads the tool name from within the SARIF file at `runs[].tool.driver.name` and uses it to construct the Test Type name.
1514

16-
SARIF parser take into account data for fingerprinting. It's base on `fingerprints` and `partialFingerprints` properties.
17-
It's possible to activate de-duplication based on this data by customizing settings.
15+
The naming pattern is: **`{tool name} ({scan_type})`**
16+
17+
For example:
18+
19+
| Tool | `runs[].tool.driver.name` value | Resulting Test Type |
20+
|------|-------------------------------|---------------------|
21+
| Semgrep | `semgrep` | `semgrep (SARIF)` |
22+
| Trivy | `Trivy Scan` | `Trivy Scan (SARIF)` |
23+
| Dockle | `Dockle` | `Dockle Scan (SARIF)` |
24+
| MobSF | `mobsfscan` | `mobsfscan (SARIF)` |
25+
26+
This means that even though all of these tools produce SARIF output and are imported with `scan_type=SARIF`, each tool will create a **distinct Test Type** in DefectDojo. For more information on how report-defined Test Types work, see **[Test Types](/asset_modelling/hierarchy/product_hierarchy#test-types)**.
27+
28+
## Reimporting SARIF Results
29+
30+
When using the `/api/v2/reimport-scan/` endpoint, DefectDojo needs to match incoming results to an existing Test. Understanding how this matching works is important when multiple SARIF-based tools are reporting into the same Engagement.
31+
32+
### One Tool Per Test
33+
34+
Each Test in DefectDojo represents results from a single tool. SARIF results from different tools (e.g. Semgrep, Trivy, MobSF) cannot be combined into the same Test, even though they share the same `scan_type=SARIF`. DefectDojo enforces this by validating that the tool name inside the SARIF file matches the existing Test's Test Type on reimport.
35+
36+
This constraint is what makes reimport's comparison logic reliable: when a Finding is absent from a new report, DefectDojo can safely assume it has been resolved. If results from multiple tools were mixed in a single Test, DefectDojo would not be able to distinguish between a resolved Finding and a Finding that simply isn't covered by the current tool.
37+
38+
## Support for Deduplication (Fingerprinting)
39+
40+
The SARIF parser takes into account data for fingerprinting, based on the `fingerprints` and `partialFingerprints` properties in the SARIF file. It's possible to activate deduplication based on this data by customizing settings:
1841

1942
```Python
2043
# in your settings.py file
@@ -25,7 +48,7 @@ DEDUPLICATION_ALGORITHM_PER_PARSER["SARIF"] = DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR
2548
Sample SARIF scans can be found [here](https://github.com/DefectDojo/django-DefectDojo/tree/master/unittests/scans/sarif).
2649

2750
### Default Deduplication Hashcode Fields
28-
By default, DefectDojo identifies duplicate Findings using these [hashcode fields](https://docs.defectdojo.com/en/working_with_findings/finding_deduplication/about_deduplication/):
51+
By default, DefectDojo identifies duplicate Findings using these [hashcode fields](/triage_findings/finding_deduplication/about_deduplication):
2952

3053
- title
3154
- cwe

0 commit comments

Comments
 (0)