Skip to content

Commit 5bdff9e

Browse files
authored
chore: add vulnerability scan VSCODE-424 (#532)
1 parent 415bc5a commit 5bdff9e

File tree

8 files changed

+1916
-673
lines changed

8 files changed

+1916
-673
lines changed

.depcheckrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ ignores:
1515
- "vscode"
1616
- "webpack-cli"
1717
- "@mongodb-js/oidc-plugin"
18+
- css-loader
19+
- less
20+
- less-loader
21+
- node-loader
22+
- postcss-loader
23+
- style-loader
24+
- ts-loader

.github/workflows/test-and-build.yaml

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,27 @@ jobs:
3535

3636
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3737
- name: Checkout
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
3939
with:
4040
fetch-depth: 0
4141

4242
- name: Setup Node.js Environment
43-
uses: actions/setup-node@v2.1.2
43+
uses: actions/setup-node@v3
4444
with:
4545
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
46-
node-version: ^16.16.0
46+
node-version: 16.x
4747

4848
- name: Run node-gyp bug workaround script
4949
run: |
5050
curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh
5151
52-
- name: Install npm@8.3.1
53-
run: npm install -g npm@8.3.1
52+
- name: Install npm
53+
run: npm install -g npm@8.19.4
5454

5555
- name: Install Dependencies
5656
shell: bash
57-
run: npm ci --omit=optional
57+
run: |
58+
npm ci --omit=optional
5859
5960
- name: Run Checks
6061
run: npm run check
@@ -63,7 +64,8 @@ jobs:
6364
shell: bash
6465

6566
- name: Run Tests
66-
run: npm run test
67+
run: |
68+
npm run test
6769
shell: bash
6870

6971
- name: Prepare build for release
@@ -96,6 +98,42 @@ jobs:
9698
name: VSIX built on ${{ runner.os }}
9799
path: "*.vsix"
98100

101+
- name: Run Snyk Test
102+
if: runner.os == 'Linux'
103+
shell: bash
104+
env:
105+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
106+
run: |
107+
npm run snyk-test > /dev/null 2>&1
108+
109+
- name: Create Jira Tickets
110+
if: >
111+
runner.os == 'Linux' &&
112+
(
113+
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
114+
github.event_name == 'workflow_dispatch' ||
115+
github.event_name == 'schedule'
116+
)
117+
shell: bash
118+
env:
119+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
120+
JIRA_BASE_URL: "https://jira.mongodb.org"
121+
JIRA_PROJECT: "VSCODE"
122+
JIRA_VULNERABILITY_BUILD_INFO: "- [GitHub Run|https://github.com/mongodb-js/vscode/actions/runs/${{github.run_id}}/jobs/${{github.job}}]"
123+
run: |
124+
npm run create-jira-tickets > /dev/null
125+
126+
- name: Generate Vulnerability Report (Fail on >= High)
127+
if: runner.os == 'Linux'
128+
continue-on-error: ${{ github.event_name == 'pull_request' }}
129+
shell: bash
130+
run: |
131+
# The standard output is suppressed since Github Actions logs are
132+
# available for everyone with read access to the repo, which is everyone that is
133+
# logged in for public repos.
134+
# This command is only here to fail on failures for `main` and tags.
135+
npm run generate-vulnerability-report > /dev/null
136+
99137
- name: Create Draft Release
100138
run: |
101139
echo Creating draft release for: "${RELEASE_TAG}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ test-webview-results.xml
99
constants.json
1010
.env
1111
.eslintcache
12+
.sbom

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ webpack.test.config.js
1717
.eslintignore
1818
playgrounds/**
1919
resources
20+
.sbom/**

0 commit comments

Comments
 (0)