Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit abe55f0

Browse files
committedSep 13, 2022
refactor: move security jobs to security.yaml
1 parent b440054 commit abe55f0

File tree

3 files changed

+104
-108
lines changed

3 files changed

+104
-108
lines changed
 

‎.github/workflows/ci.yaml

-61
Original file line numberDiff line numberDiff line change
@@ -62,40 +62,6 @@ jobs:
6262
run: yarn lint
6363
if: success()
6464

65-
audit-ci:
66-
name: Run audit-ci
67-
needs: prebuild
68-
runs-on: ubuntu-latest
69-
timeout-minutes: 15
70-
steps:
71-
- name: Checkout repo
72-
uses: actions/checkout@v3
73-
with:
74-
fetch-depth: 0
75-
submodules: true
76-
77-
- name: Install Node.js v16
78-
uses: actions/setup-node@v3
79-
with:
80-
node-version: "16"
81-
82-
- name: Fetch dependencies from cache
83-
id: cache-yarn
84-
uses: actions/cache@v3
85-
with:
86-
path: "**/node_modules"
87-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
88-
restore-keys: |
89-
yarn-build-
90-
91-
- name: Install dependencies
92-
if: steps.cache-yarn.outputs.cache-hit != 'true'
93-
run: yarn --frozen-lockfile
94-
95-
- name: Audit for vulnerabilities
96-
run: yarn _audit
97-
if: success()
98-
9965
build:
10066
name: Build
10167
needs: prebuild
@@ -596,30 +562,3 @@ jobs:
596562

597563
- name: Remove release packages and test artifacts
598564
run: rm -rf ./release-packages ./test/test-results
599-
600-
trivy-scan-repo:
601-
permissions:
602-
contents: read # for actions/checkout to fetch code
603-
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
604-
runs-on: ubuntu-20.04
605-
steps:
606-
- name: Checkout repo
607-
uses: actions/checkout@v3
608-
with:
609-
fetch-depth: 0
610-
611-
- name: Run Trivy vulnerability scanner in repo mode
612-
uses: aquasecurity/trivy-action@d63413b0a4a4482237085319f7f4a1ce99a8f2ac
613-
with:
614-
scan-type: "fs"
615-
scan-ref: "."
616-
ignore-unfixed: true
617-
format: "template"
618-
template: "@/contrib/sarif.tpl"
619-
output: "trivy-repo-results.sarif"
620-
severity: "HIGH,CRITICAL"
621-
622-
- name: Upload Trivy scan results to GitHub Security tab
623-
uses: github/codeql-action/upload-sarif@v2
624-
with:
625-
sarif_file: "trivy-repo-results.sarif"

‎.github/workflows/codeql-analysis.yml

-47
This file was deleted.

‎.github/workflows/security.yaml

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
name: "Security Scanning"
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: [main]
10+
schedule:
11+
# Runs every Monday morning PST
12+
- cron: "17 15 * * 1"
13+
14+
# Cancel in-progress runs for pull requests when developers push
15+
# additional changes, and serialize builds in branches.
16+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20+
21+
jobs:
22+
audit-ci:
23+
name: Run audit-ci
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 15
26+
steps:
27+
- name: Checkout repo
28+
uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Install Node.js v16
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: "16"
36+
37+
- name: Fetch dependencies from cache
38+
id: cache-yarn
39+
uses: actions/cache@v3
40+
with:
41+
path: "**/node_modules"
42+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
43+
restore-keys: |
44+
yarn-build-
45+
46+
- name: Install dependencies
47+
if: steps.cache-yarn.outputs.cache-hit != 'true'
48+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
49+
50+
- name: Audit for vulnerabilities
51+
run: yarn _audit
52+
if: success()
53+
54+
trivy-scan-repo:
55+
permissions:
56+
contents: read # for actions/checkout to fetch code
57+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
58+
runs-on: ubuntu-20.04
59+
steps:
60+
- name: Checkout repo
61+
uses: actions/checkout@v3
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Run Trivy vulnerability scanner in repo mode
66+
uses: aquasecurity/trivy-action@d63413b0a4a4482237085319f7f4a1ce99a8f2ac
67+
with:
68+
scan-type: "fs"
69+
scan-ref: "."
70+
ignore-unfixed: true
71+
format: "template"
72+
template: "@/contrib/sarif.tpl"
73+
output: "trivy-repo-results.sarif"
74+
severity: "HIGH,CRITICAL"
75+
76+
- name: Upload Trivy scan results to GitHub Security tab
77+
uses: github/codeql-action/upload-sarif@v2
78+
with:
79+
sarif_file: "trivy-repo-results.sarif"
80+
81+
codeql-analyze:
82+
permissions:
83+
actions: read # for github/codeql-action/init to get workflow details
84+
contents: read # for actions/checkout to fetch code
85+
security-events: write # for github/codeql-action/autobuild to send a status report
86+
name: Analyze
87+
runs-on: ubuntu-20.04
88+
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v3
92+
93+
# Initializes the CodeQL tools for scanning.
94+
- name: Initialize CodeQL
95+
uses: github/codeql-action/init@v2
96+
with:
97+
config-file: ./.github/codeql-config.yml
98+
languages: javascript
99+
100+
- name: Autobuild
101+
uses: github/codeql-action/autobuild@v2
102+
103+
- name: Perform CodeQL Analysis
104+
uses: github/codeql-action/analyze@v2

0 commit comments

Comments
 (0)
Please sign in to comment.