Skip to content

Commit 5582dae

Browse files
authored
Merge pull request #77 from microsoft/containerMappingPreview
Container mapping preview
2 parents 7971bce + 6732229 commit 5582dae

31 files changed

+4373
-3338
lines changed

.github/workflows/on-push-verification.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
- '**'
88

99
permissions:
10-
security-events: write
10+
id-token: write # This is required for federation to Defender for DevOps
11+
security-events: write # This is required to upload SARIF files
1112

1213
jobs:
1314
sample:
@@ -24,8 +25,7 @@ jobs:
2425
- uses: actions/checkout@v3
2526

2627
# Run analyzers
27-
- name: Run Microsoft Security DevOps Analysis
28-
uses: ./
28+
- uses: ./
2929
id: msdo
3030

3131
# Upload alerts to the Security tab

.github/workflows/sample-workflow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
- main
66

77
permissions:
8-
security-events: write
8+
id-token: write # This is required for federation to Defender for DevOps
9+
security-events: write # This is required to upload SARIF files
910

1011
jobs:
1112
sample:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ bld/
2323
[Bb]in/
2424
[Oo]bj/
2525
[Ll]og/
26+
test/**/*.js
2627

2728
# Visual Studio 2015/2017 cache/options directory
2829
.vs/

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ To upload results to the Security tab of your repo, run the `github/codeql-actio
4848
sarif_file: ${{ steps.msdo.outputs.sarifFile }}
4949
```
5050

51+
## Advanced
52+
53+
To configure **Container Mapping** to send to **Microsoft Defender for DevOps**, include `container-mapping` as a tool:
54+
```yaml
55+
- uses: microsoft/security-devops-action@v1
56+
id: msdo
57+
with:
58+
includeTools: container-mapping
59+
```
60+
61+
This will run all the analyzers defined by the configured or defaulted policy in addition to `container-mapping`. To only run this feature, define `container-mapping` as the only `tool` to run:
62+
```yaml
63+
- uses: microsoft/security-devops-action@v1
64+
id: msdo
65+
with:
66+
tools: container-mapping
67+
```
68+
5169
# Tools
5270

5371
| Name | Language | License |

action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ branding:
55
icon: 'shield'
66
color: 'black'
77
inputs:
8+
command:
9+
description: The command to run. Defaults to run.
10+
default: all
11+
options:
12+
- all
13+
- run
14+
- pre-job
15+
- post-job
816
config:
917
description: A file path to a .gdnconfig file.
1018
policy:
@@ -15,10 +23,14 @@ inputs:
1523
languages:
1624
description: A comma separated list of languages to analyze. Example javascript, typescript. Defaults to all.
1725
tools:
18-
description: A comma separated list of analyzer tools to run. Example bandit, binskim, eslint, templateanalyzer, terrascan, trivy.
26+
description: A comma separated list of analyzer to run. Example bandit, binskim, container-mapping, eslint, templateanalyzer, terrascan, trivy.
27+
includeTools:
28+
description: A comma separated list of analyzers to run in addition to the default set defined by the policy. Limited to container-mapping
1929
outputs:
2030
sarifFile:
2131
description: A file path to a SARIF results file.
2232
runs:
2333
using: 'node16'
24-
main: 'lib/action.js'
34+
main: 'lib/main.js'
35+
pre: 'lib/pre.js'
36+
post: 'lib/post.js'

gulpfile.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const process = require('process');
66
const ts = require('gulp-typescript');
77

88
const tsProject = ts.createProject('tsconfig.json');
9+
const testTsProject = ts.createProject(path.join(__dirname, 'test', 'tsconfig.json'));
910

1011
function clean(cb) {
1112
import('del')
@@ -58,6 +59,14 @@ function compile(cb) {
5859
.on('end', () => cb());
5960
}
6061

62+
function compileTests(cb) {
63+
testTsProject
64+
.src()
65+
.pipe(testTsProject()).js
66+
.pipe(gulp.dest(path.join(__dirname, 'test')))
67+
.on('end', () => cb());
68+
}
69+
6170
function clearDir(dirPath) {
6271
// Get a list of files and subdirectories in the directory
6372
const items = fs.readdirSync(dirPath);
@@ -96,5 +105,7 @@ function copyFiles(srcDir, destDir) {
96105

97106
exports.clean = clean;
98107
exports.compile = compile;
108+
exports.compileTests = compileTests;
99109
exports.build = gulp.series(clean, sideload, compile);
110+
exports.buildTests = gulp.series(exports.build, compileTests);
100111
exports.default = exports.build;

lib/action.js

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)