Skip to content

Commit 6f98e08

Browse files
committed
feat(ci): add audit job for security
1 parent fbb5e6e commit 6f98e08

File tree

6 files changed

+198
-4
lines changed

6 files changed

+198
-4
lines changed

.github/workflows/ci.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ jobs:
2727
with:
2828
args: ./ci/steps/lint.sh
2929

30+
audit:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v2
34+
- name: Audit for vulnerabilities
35+
uses: ./ci/images/debian10
36+
with:
37+
args: ./ci/steps/audit.sh
38+
3039
test-unit:
3140
runs-on: ubuntu-latest
3241
steps:

ci/dev/audit.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
main() {
5+
cd "$(dirname "$0")/../.."
6+
7+
# Prevents integration with moderate or higher vulnerabilities
8+
# Docs: https://github.com/IBM/audit-ci#options
9+
yarn audit-ci --moderate
10+
}
11+
12+
main "$@"

ci/dev/ci.sh

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ main() {
66

77
yarn fmt
88
yarn lint
9+
yarn _audit
910
yarn test:unit
1011
}
1112

ci/steps/audit.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
main() {
5+
cd "$(dirname "$0")/../.."
6+
7+
yarn --frozen-lockfile
8+
9+
yarn _audit
10+
}
11+
12+
main "$@"

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"postinstall": "./ci/dev/postinstall.sh",
2525
"update:vscode": "./ci/dev/update-vscode.sh",
2626
"_____": "",
27+
"_audit": "./ci/dev/audit.sh",
2728
"fmt": "./ci/dev/fmt.sh",
2829
"lint": "./ci/dev/lint.sh",
2930
"test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1",
@@ -54,6 +55,7 @@
5455
"@types/wtfnode": "^0.7.0",
5556
"@typescript-eslint/eslint-plugin": "^4.7.0",
5657
"@typescript-eslint/parser": "^4.7.0",
58+
"audit-ci": "^3.1.1",
5759
"doctoc": "^2.0.0",
5860
"eslint": "^7.7.0",
5961
"eslint-config-prettier": "^8.1.0",

0 commit comments

Comments
 (0)