Skip to content

Scheduling infrastructure for absolutely everyone.

chore: add npm audit in CI (#27182)

Udit Takkard997be2a3cce
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index aa36e440edd..e6713a91ca8 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -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' ||
diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml
new file mode 100644
index 00000000000..c59d452a074
--- /dev/null
+++ b/.github/workflows/security-audit.yml
@@ -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