Skip to content

Commit

Permalink
feat: add in use flag
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Eulalio <igor.eulalio@sysdig.com>
  • Loading branch information
IgorEulalio committed Dec 11, 2024
1 parent d9114f7 commit 9d1c735
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ inputs:
description: 'Path to the IaC files to scan.'
required: false
default: "./"
in-use-file-path:
description: 'Path to the in-use file.'
required: false
default: "./in_use.txt"

outputs:
scanReport:
description: Path to a JSON file containing the report results, failed evaluation gates, and found vulnerabilities.
Expand Down
7 changes: 7 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface ActionInputParameters {
recursive: boolean;
minimumSeverity: string;
iacScanPath: string;
inUseFilePath: string;
}

export class ActionInputs {
Expand Down Expand Up @@ -77,6 +78,7 @@ export class ActionInputs {
recursive: core.getInput('recursive') == 'true',
minimumSeverity: core.getInput('minimum-severity'),
iacScanPath: core.getInput('iac-scan-path') || './',
inUseFilePath: core.getInput('in-use-file-path') || './in-use.txt',
};

const overridenParams = {
Expand Down Expand Up @@ -128,6 +130,10 @@ export class ActionInputs {
return this.params.overridePullString
}

get inUseFilePath() {
return this.params.inUseFilePath
}

private static validateInputs(params: ActionInputParameters) {
if (!params.standalone && !params.sysdigSecureToken) {
core.setFailed("Sysdig Secure Token is required for standard execution, please set your token or remove the standalone input.");
Expand Down Expand Up @@ -196,6 +202,10 @@ export class ActionInputs {
flags += ` ${this.params.extraParameters}`;
}

if (this.params.inUseFilePath) {
flags += ` --in-use-packages-file=${this.params.inUseFilePath}`;
}

if (this.params.mode == ScanMode.iac) {
flags += ` --iac`;

Expand Down

0 comments on commit 9d1c735

Please sign in to comment.