-
Notifications
You must be signed in to change notification settings - Fork 71
Add OpenTaint SARIF reader support #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
davewichers
merged 5 commits into
OWASP-Benchmark:main
from
seqradev:seqradev/support-seqra
May 13, 2026
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b7932c5
Add Seqra SARIF reader support
seqradev e3f1508
Remove an unnecessary method override
seqradev 0f94428
Rename Seqra to OpenTaint across reader, tests, and SARIF fixtures
seqradev 51e26f5
Fix expected tool version in OpenTaintReaderTest to match SARIF fixture
seqradev b19172d
Move OpenTaintReader into alphabetical order
seqradev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
plugin/src/main/java/org/owasp/benchmarkutils/score/parsers/sarif/SeqraReader.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /** | ||
| * OWASP Benchmark Project | ||
| * | ||
| * <p>This file is part of the Open Web Application Security Project (OWASP) Benchmark Project For | ||
| * details, please see <a | ||
| * href="https://owasp.org/www-project-benchmark/">https://owasp.org/www-project-benchmark/</a>. | ||
| * | ||
| * <p>The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms | ||
| * of the GNU General Public License as published by the Free Software Foundation, version 2. | ||
| * | ||
| * <p>The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
| * PURPOSE. See the GNU General Public License for more details. | ||
| * | ||
| * @author Seqra Team | ||
| * @created 2026 | ||
| */ | ||
| package org.owasp.benchmarkutils.score.parsers.sarif; | ||
|
|
||
| import org.owasp.benchmarkutils.score.CweNumber; | ||
| import org.owasp.benchmarkutils.score.ResultFile; | ||
|
|
||
| /** | ||
| * This reader is made for Seqra, a security static analysis tool. It uses the SARIF file produced | ||
| * by the tool. | ||
| */ | ||
| public class SeqraReader extends SarifReader { | ||
|
|
||
| public SeqraReader() { | ||
| super("Seqra", false, CweSourceType.TAG); | ||
| } | ||
|
|
||
| @Override | ||
| public String toolName(ResultFile resultFile) { | ||
| return "Seqra"; | ||
| } | ||
|
|
||
| /** | ||
| * Maps Seqra CWE numbers to Benchmark expected CWEs. | ||
| * | ||
| * <p>The SarifReader base class only uses the first CWE tag from each rule. Some Seqra rules | ||
| * have multiple CWE tags where the first one doesn't match Benchmark's expected CWE. This | ||
| * method provides ad-hoc mappings for such cases. | ||
| * | ||
| * <p>Example: The rule "java.security.cookie-issecure-false" has tags [CWE-319, CWE-614]. The | ||
| * parser picks CWE-319 (Cleartext Transmission), but Benchmark expects CWE-614 (Insecure | ||
| * Cookie) for the "securecookie" category. | ||
| */ | ||
| @Override | ||
| public int mapCwe(int cwe) { | ||
| switch (cwe) { | ||
| case 319: | ||
| // cookie-issecure-false rule has [CWE-319, CWE-614] | ||
| // Benchmark expects CWE-614 for securecookie category | ||
| return CweNumber.INSECURE_COOKIE; | ||
| default: | ||
| return cwe; | ||
| } | ||
| } | ||
| } | ||
74 changes: 74 additions & 0 deletions
74
plugin/src/test/java/org/owasp/benchmarkutils/score/parsers/sarif/SeqraReaderTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /** | ||
| * OWASP Benchmark Project | ||
| * | ||
| * <p>This file is part of the Open Web Application Security Project (OWASP) Benchmark Project For | ||
| * details, please see <a | ||
| * href="https://owasp.org/www-project-benchmark/">https://owasp.org/www-project-benchmark/</a>. | ||
| * | ||
| * <p>The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms | ||
| * of the GNU General Public License as published by the Free Software Foundation, version 2. | ||
| * | ||
| * <p>The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
| * PURPOSE. See the GNU General Public License for more details. | ||
| * | ||
| * @author Seqra Team | ||
| * @created 2026 | ||
| */ | ||
| package org.owasp.benchmarkutils.score.parsers.sarif; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
|
||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.owasp.benchmarkutils.score.BenchmarkScore; | ||
| import org.owasp.benchmarkutils.score.CweNumber; | ||
| import org.owasp.benchmarkutils.score.ResultFile; | ||
| import org.owasp.benchmarkutils.score.TestHelper; | ||
| import org.owasp.benchmarkutils.score.TestSuiteResults; | ||
| import org.owasp.benchmarkutils.score.parsers.ReaderTestBase; | ||
|
|
||
| public class SeqraReaderTest extends ReaderTestBase { | ||
|
|
||
| private ResultFile resultFile; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| resultFile = TestHelper.resultFileOf("testfiles/Benchmark_Seqra.sarif"); | ||
| BenchmarkScore.TESTCASENAME = "BenchmarkTest"; | ||
| } | ||
|
|
||
| @Test | ||
| public void onlySeqraReaderTestReportsCanReadAsTrue() { | ||
| assertOnlyMatcherClassIs(this.resultFile, SeqraReader.class); | ||
| } | ||
|
|
||
| @Test | ||
| void readerHandlesGivenResultFile() throws Exception { | ||
| SeqraReader reader = new SeqraReader(); | ||
| TestSuiteResults result = reader.parse(resultFile); | ||
|
|
||
| assertEquals(TestSuiteResults.ToolType.SAST, result.getToolType()); | ||
| assertEquals("Seqra", result.getToolName()); | ||
| assertEquals("v2.2.0", result.getToolVersion()); | ||
| assertFalse(result.isCommercial()); | ||
|
|
||
| assertEquals(2, result.getTotalResults()); | ||
|
|
||
| assertEquals(CweNumber.WEAK_HASH_ALGO, result.get(2670).get(0).getCWE()); | ||
| assertEquals(CweNumber.INSECURE_COOKIE, result.get(2710).get(0).getCWE()); | ||
| } | ||
|
|
||
| @Test | ||
| void mapCweMapsInsecureCookieCwe() { | ||
| SeqraReader reader = new SeqraReader(); | ||
|
|
||
| // CWE-319 (Cleartext Transmission) should map to CWE-614 (Insecure Cookie) | ||
| assertEquals(CweNumber.INSECURE_COOKIE, reader.mapCwe(319)); | ||
|
|
||
| // Other CWEs should pass through unchanged | ||
| assertEquals(328, reader.mapCwe(328)); | ||
| assertEquals(327, reader.mapCwe(327)); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.