2022-09-22 22:33:32 +03:00
|
|
|
name: Security
|
2022-09-14 16:31:13 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
2022-09-29 22:46:48 +03:00
|
|
|
paths:
|
|
|
|
- "package.json"
|
2022-09-14 16:31:13 +03:00
|
|
|
pull_request:
|
2022-09-29 22:46:48 +03:00
|
|
|
paths:
|
|
|
|
- "package.json"
|
2022-09-14 16:31:13 +03:00
|
|
|
schedule:
|
|
|
|
# Runs every Monday morning PST
|
|
|
|
- cron: "17 15 * * 1"
|
|
|
|
|
2023-03-21 23:16:22 +03:00
|
|
|
# Cancel in-progress runs for pull requests when developers push additional
|
|
|
|
# changes, and serialize builds in branches.
|
2022-09-14 16:31:13 +03:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
|
|
|
jobs:
|
2024-07-11 00:15:15 +03:00
|
|
|
audit:
|
2022-09-22 22:33:32 +03:00
|
|
|
name: Audit node modules
|
2022-09-14 16:31:13 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2023-10-05 02:50:11 +03:00
|
|
|
uses: actions/checkout@v4
|
2022-09-14 16:31:13 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-11-15 00:45:56 +03:00
|
|
|
- name: Install Node.js
|
2023-11-14 21:23:05 +03:00
|
|
|
uses: actions/setup-node@v4
|
2022-09-14 16:31:13 +03:00
|
|
|
with:
|
2023-11-15 00:45:56 +03:00
|
|
|
node-version-file: .node-version
|
2022-09-14 16:31:13 +03:00
|
|
|
|
2023-09-22 03:13:34 +03:00
|
|
|
- name: Audit npm for vulnerabilities
|
2024-10-18 07:31:28 +03:00
|
|
|
run: npm audit
|
2022-09-14 16:31:13 +03:00
|
|
|
if: success()
|
|
|
|
|
|
|
|
trivy-scan-repo:
|
2022-09-22 22:33:32 +03:00
|
|
|
name: Scan repo with Trivy
|
2022-09-14 16:31:13 +03:00
|
|
|
permissions:
|
|
|
|
contents: read # for actions/checkout to fetch code
|
|
|
|
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2023-10-05 02:50:11 +03:00
|
|
|
uses: actions/checkout@v4
|
2022-09-14 16:31:13 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Run Trivy vulnerability scanner in repo mode
|
2024-07-11 00:10:01 +03:00
|
|
|
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8
|
2022-09-14 16:31:13 +03:00
|
|
|
with:
|
|
|
|
scan-type: "fs"
|
|
|
|
scan-ref: "."
|
|
|
|
ignore-unfixed: true
|
|
|
|
format: "template"
|
|
|
|
template: "@/contrib/sarif.tpl"
|
|
|
|
output: "trivy-repo-results.sarif"
|
|
|
|
severity: "HIGH,CRITICAL"
|
|
|
|
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
2024-02-02 04:37:33 +03:00
|
|
|
uses: github/codeql-action/upload-sarif@v3
|
2022-09-14 16:31:13 +03:00
|
|
|
with:
|
|
|
|
sarif_file: "trivy-repo-results.sarif"
|
|
|
|
|
|
|
|
codeql-analyze:
|
|
|
|
permissions:
|
|
|
|
actions: read # for github/codeql-action/init to get workflow details
|
|
|
|
contents: read # for actions/checkout to fetch code
|
|
|
|
security-events: write # for github/codeql-action/autobuild to send a status report
|
2022-09-22 22:33:32 +03:00
|
|
|
name: Analyze with CodeQL
|
2022-09-14 16:31:13 +03:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-10-05 02:50:11 +03:00
|
|
|
uses: actions/checkout@v4
|
2022-09-14 16:31:13 +03:00
|
|
|
|
|
|
|
# Initializes the CodeQL tools for scanning.
|
|
|
|
- name: Initialize CodeQL
|
2024-02-02 04:37:33 +03:00
|
|
|
uses: github/codeql-action/init@v3
|
2022-09-14 16:31:13 +03:00
|
|
|
with:
|
|
|
|
config-file: ./.github/codeql-config.yml
|
|
|
|
languages: javascript
|
|
|
|
|
|
|
|
- name: Autobuild
|
2024-02-02 04:37:33 +03:00
|
|
|
uses: github/codeql-action/autobuild@v3
|
2022-09-14 16:31:13 +03:00
|
|
|
|
|
|
|
- name: Perform CodeQL Analysis
|
2024-02-02 04:37:33 +03:00
|
|
|
uses: github/codeql-action/analyze@v3
|