chore: add npm audit in CI (#27182)
* chore: add npm audit in CI * chore: add npm audit in CI
This commit is contained in:
@@ -326,6 +326,13 @@ jobs:
|
||||
uses: ./.github/workflows/api-v2-unit-tests.yml
|
||||
secrets: inherit
|
||||
|
||||
security-audit:
|
||||
name: Security Audit
|
||||
needs: [prepare]
|
||||
if: ${{ needs.prepare.outputs.has-files-requiring-all-checks == 'true' }}
|
||||
uses: ./.github/workflows/security-audit.yml
|
||||
secrets: inherit
|
||||
|
||||
check-prisma-migrations:
|
||||
name: Check Prisma Migrations
|
||||
needs: [prepare]
|
||||
@@ -462,6 +469,7 @@ jobs:
|
||||
type-check,
|
||||
unit-test,
|
||||
api-v2-unit-test,
|
||||
security-audit,
|
||||
check-api-v2-breaking-changes,
|
||||
check-prisma-migrations,
|
||||
integration-test,
|
||||
@@ -504,6 +512,7 @@ jobs:
|
||||
needs.type-check.result != 'success' ||
|
||||
needs.unit-test.result != 'success' ||
|
||||
needs.api-v2-unit-test.result != 'success' ||
|
||||
needs.security-audit.result != 'success' ||
|
||||
(needs.prepare.outputs.has-api-v2-changes == 'true' && needs.check-api-v2-breaking-changes.result != 'success') ||
|
||||
(needs.prepare.outputs.has-prisma-changes == 'true' && needs.check-prisma-migrations.result != 'success') ||
|
||||
needs.build.result != 'success' ||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
name: Security Audit
|
||||
on:
|
||||
workflow_call:
|
||||
permissions:
|
||||
actions: write
|
||||
contents: read
|
||||
jobs:
|
||||
audit:
|
||||
runs-on: blacksmith-2vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: .github
|
||||
- uses: ./.github/actions/cache-checkout
|
||||
- uses: ./.github/actions/yarn-install
|
||||
- name: Report all vulnerabilities
|
||||
run: yarn npm audit --all --recursive || true
|
||||
- name: Fail on critical vulnerabilities
|
||||
run: yarn npm audit --all --recursive --severity critical
|
||||
Reference in New Issue
Block a user