From 9b6ea38fc4d9ec143088f4b9b3b765f37ec51f9d Mon Sep 17 00:00:00 2001 From: Vaibhav Bhalla Date: Tue, 23 Sep 2025 11:45:29 +0530 Subject: [PATCH] feat(ci-cd): add audit scan add audit scan GH-157 --- .github/workflows/audit.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/audit.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..b34dda7 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,31 @@ +name: Audit +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + npm_audit: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Install Monorepo Deps + run: npm ci + + - name: Run npm audit + run: > + npm audit --json | + node -e ' + const fs = require("fs"); + const auditLevel = (process.argv[1] || "critical").toLowerCase(); + const { vulnerabilities } = JSON.parse(fs.readFileSync(0).toString("utf-8")); + const result = Object.values(vulnerabilities).filter((i) => i.severity.toLowerCase() === auditLevel); + console.table(JSON.stringify(result, null, 2)); + ' high