Skip to content

Commit 2eacb7f

Browse files
DimaBirDima Birenbaum
andauthored
feat(break): add break-on-detections input to enable build failure on vulnerabilities AB#36807380 (#160)
Co-authored-by: Dima Birenbaum <dbirenbaum@microsoft.com>
1 parent f53222b commit 2eacb7f

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ inputs:
2020
description: A comma separated list of analyzer to run. Example bandit, binskim, container-mapping, eslint, templateanalyzer, terrascan, trivy.
2121
includeTools:
2222
description: Deprecated
23+
break-on-detections:
24+
description: If true, the action will fail the build when vulnerabilities are detected at or above the configured severity. Requires toolkit support for MSDO_BREAK.
25+
default: 'false'
2326
existingFilename:
2427
description: A SARIF filename that already exists. If it does, then the normal run will not take place and the file will instead be uploaded to MSDO backend.
2528
outputs:

lib/msdo.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class MicrosoftSecurityDevOps {
112112
}
113113
args.push('--github');
114114
}
115+
let breakOnDetections = core.getInput('break-on-detections');
116+
if (breakOnDetections && breakOnDetections.trim().toUpperCase() === 'TRUE') {
117+
process.env.MSDO_BREAK = 'true';
118+
core.debug('break-on-detections is enabled, set MSDO_BREAK=true');
119+
}
115120
yield client.run(args, 'microsoft/security-devops-action');
116121
});
117122
}

src/msdo.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ export class MicrosoftSecurityDevOps implements IMicrosoftSecurityDevOps {
9797
args.push('--github');
9898
}
9999

100+
let breakOnDetections: string = core.getInput('break-on-detections');
101+
if (breakOnDetections && breakOnDetections.trim().toUpperCase() === 'TRUE') {
102+
process.env.MSDO_BREAK = 'true';
103+
core.debug('break-on-detections is enabled, set MSDO_BREAK=true');
104+
}
105+
100106
await client.run(args, 'microsoft/security-devops-action');
101107
}
102108
}

0 commit comments

Comments
 (0)