Skip to content

Commit 542b34d

Browse files
committed
ci(workspace): add npm audit workflow to scan dependencies
introduce automated security scanning for dependencies by running `npm audit` in pull requests. this ensures vulnerabilities are caught earlier in the development cycle and increases visibility for reviewers. Closes #153
1 parent 9275cad commit 542b34d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/npm-audit.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# -------------------------------------------------------------------------------------
2+
#
3+
# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
4+
#
5+
# WSO2 LLC. licenses this file to you under the Apache License,
6+
# Version 2.0 (the "License"); you may not use this file except
7+
# in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
# --------------------------------------------------------------------------------------
20+
21+
# This workflow will perform a security audit on the codebase.
22+
23+
on:
24+
pull_request:
25+
branches: [ main ]
26+
27+
jobs:
28+
audit:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 18
38+
39+
- name: Install dependencies
40+
run: npm install
41+
42+
- name: Run npm audit (fail on critical)
43+
run: npm audit --audit-level=high --json > audit-results.json
44+
45+
- name: Upload audit results
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: npm-audit-report
49+
path: audit-results.json

0 commit comments

Comments
 (0)