Skip to content
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

SCAN-5495 : Expose timeout option. #2

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ up. After which, complete the following steps:
- checks : If set, GitHub checks will be added to the current commit based on any vulnerabilities found.
- codeQuality : Passes the -q option to the Contrast local scanner to include code quality rules in the scan.
- label : Label to associate with the current scan. Defaults to the current ref e.g. **refs/heads/main**
- memory : Memory setting passed to the underlying scan engine. Defaulted to 2g.
- memory : Memory setting passed to the underlying scan engine. Defaulted to 8g.
- path : Path to scan with Contrast local scanner. Defaults to the current repository path.
- projectName : Project to associate scan with. Defaults to current GitHub repository name e.g. **Contrast-Security-OSS/contrast-local-scan-action**
- resourceGroup : Passes the -r option to the Contrast local scanner to associate newly created projects with the specified resource group.
- severity : Set this to cause the build to fail if vulnerabilities are found at this severity or higher. Valid values are critical, high, medium, low, note.
- timeout: Execution timeout (in seconds) setting passed to the underlying scan engine. Defaulted to 60 minutes.



Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inputs:
label:
description: Label to associate with the current scan. Defaults to the current ref e.g. refs/heads/main
memory:
description: Memory setting passed to the underlying scan engine. Defaulted to 2g
description: Memory setting passed to the underlying scan engine. Defaulted to 8g
required: false
path:
description: Path to scan with local scanner. Defaults to the current repository path.
Expand All @@ -52,6 +52,9 @@ inputs:
Set this to cause the build to fail if vulnerabilities are found exceeding this severity or higher.
Valid values are CRITICAL, HIGH, MEDIUM, LOW, NOTE.
required: false
timeout:
description: Execution timeout (in seconds) setting passed to the underlying scan engine. Defaulted to 60 minutes.
required: false
token:
description: >
GitHub token for GitHub API requests. Defaults to GITHUB_TOKEN.
Expand Down
4 changes: 3 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const codeQuality = core.getBooleanInput("codeQuality");
const label = core.getInput("label") || process.env.GITHUB_REF;

// Pinning the local scanner version
const localScannerVersion = "1.0.7";
const localScannerVersion = "1.0.8";

const memory = core.getInput("memory");
const path = core.getInput("path") || process.env.GITHUB_WORKSPACE;
Expand All @@ -29,6 +29,7 @@ const projectName =
const resourceGroup = core.getInput("resourceGroup");
const severity = core.getInput("severity")?.toLowerCase() || undefined;
const strategy = core.getInput("strategy") || "project";
const timeout = core.getInput("timeout");
const title = "Contrast Local Scan";
const token = core.getInput("token");

Expand All @@ -50,6 +51,7 @@ module.exports = {
resourceGroup,
severity,
strategy,
timeout,
title,
token,
};
5 changes: 5 additions & 0 deletions src/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {
resourceGroup,
severity,
strategy,
timeout,
title,
} = require("./config");

Expand Down Expand Up @@ -51,6 +52,10 @@ function scanOpts(jar) {
options.push("--memory", memory);
}

if (timeout) {
options.push("--timeout", timeout);
}

if (resourceGroup) {
options.push("-r", resourceGroup);
}
Expand Down
Loading