-
-
Notifications
You must be signed in to change notification settings - Fork 163
Explain what tripped the fail-on gate and document only-used scope #1239
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c45e8a3
scan explain what tripped the fail-on gate on failure
theluckystrike b83eb9d
scan explain what tripped the fail-on gate on failure
theluckystrike 71f5140
scan explain what tripped the fail-on gate on failure
theluckystrike 53f34f2
docs scope only-used to vulnerability findings
theluckystrike a9c7b61
scan explain what tripped the fail-on gate on failure
theluckystrike d7d6db6
Merge branch 'OWASP:main' into fail-on-gate-line
theluckystrike 267fa3d
Merge remote-tracking branch 'upstream/main' into fail-on-gate-line
theluckystrike 90ffa3d
scan derive the fail-on exit from the gate line and pin it with tests
theluckystrike 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
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
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
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
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
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,67 @@ | ||
| import { failingGateSummary } from "../../src/utils/severity.js"; | ||
|
|
||
| describe("failingGateSummary", () => { | ||
| it("names the class and threshold for the maintainer reproduction in issue #1000", () => { | ||
| const line = failingGateSummary( | ||
| [{ label: "override hygiene", findings: [{ severity: "low" }] }], | ||
| "low", | ||
| ); | ||
| expect(line).toBe( | ||
| "Failing: 1 override hygiene finding at or above low (--fail-on low).", | ||
| ); | ||
| }); | ||
|
|
||
| it("counts only findings that meet or exceed the threshold", () => { | ||
| const line = failingGateSummary( | ||
| [ | ||
| { label: "vulnerability", findings: [{ severity: "critical" }, { severity: "low" }] }, | ||
| { label: "override hygiene", findings: [{ severity: "low" }] }, | ||
| ], | ||
| "high", | ||
| ); | ||
| expect(line).toBe( | ||
| "Failing: 1 vulnerability finding at or above high (--fail-on high).", | ||
| ); | ||
| }); | ||
|
|
||
| it("joins multiple tripped classes with correct pluralization", () => { | ||
| const line = failingGateSummary( | ||
| [ | ||
| { label: "vulnerability", findings: [{ severity: "high" }, { severity: "high" }] }, | ||
| { label: "maintenance risk", findings: [{ severity: "high" }] }, | ||
| ], | ||
| "medium", | ||
| ); | ||
| expect(line).toBe( | ||
| "Failing: 2 vulnerability findings, 1 maintenance risk finding at or above medium (--fail-on medium).", | ||
| ); | ||
| }); | ||
|
|
||
| it("returns null on a clean run so output is unchanged", () => { | ||
| expect( | ||
| failingGateSummary([{ label: "vulnerability", findings: [{ severity: "low" }] }], "high"), | ||
| ).toBeNull(); | ||
| }); | ||
|
|
||
| it("returns null when --fail-on is not set", () => { | ||
| expect( | ||
| failingGateSummary([{ label: "vulnerability", findings: [{ severity: "critical" }] }], ""), | ||
| ).toBeNull(); | ||
| }); | ||
|
|
||
| it("returns null for an empty class list", () => { | ||
| expect(failingGateSummary([], "low")).toBeNull(); | ||
| }); | ||
|
|
||
| it("echoes the raw --fail-on value instead of the normalized level", () => { | ||
| // normalizeSeverity falls back to critical for an unknown value, so the | ||
| // parenthetical must show what the user typed, not a value they did not. | ||
| const line = failingGateSummary( | ||
| [{ label: "vulnerability", findings: [{ severity: "critical" }] }], | ||
| "hgih", | ||
| ); | ||
| expect(line).toBe( | ||
| "Failing: 1 vulnerability finding at or above critical (--fail-on hgih).", | ||
| ); | ||
| }); | ||
| }); |
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
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.