Skip to content

Commit ef9542b

Browse files
authored
Add dependency review workflow for PRs
Signed-off-by: emmanuelgjr <129134995+emmanuelgjr@users.noreply.github.com>
1 parent b9fb40d commit ef9542b

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Blocks PRs that introduce known-vulnerable, license-incompatible, or
2+
# malware-flagged dependencies before they reach main.
3+
# Docs: https://github.com/actions/dependency-review-action
4+
5+
name: Dependency Review
6+
7+
on:
8+
pull_request:
9+
branches: [ "main" ]
10+
merge_group:
11+
12+
# Cancel superseded runs on the same PR to save minutes.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
# Least-privilege: read code, comment on PRs, nothing else.
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
22+
jobs:
23+
dependency-review:
24+
name: Scan PR for vulnerable / disallowed dependencies
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
steps:
28+
- name: Harden runner
29+
# Pin to SHA in production: replace @v2 with the commit SHA from
30+
# https://github.com/step-security/harden-runner/releases
31+
uses: step-security/harden-runner@v2
32+
with:
33+
egress-policy: audit
34+
35+
- name: Checkout
36+
# Pin to SHA in production.
37+
uses: actions/checkout@v4
38+
with:
39+
persist-credentials: false
40+
41+
- name: Dependency Review
42+
# Pin to SHA in production.
43+
uses: actions/dependency-review-action@v4
44+
with:
45+
# Block on Moderate+; raise to "high" only if you get noisy results.
46+
fail-on-severity: moderate
47+
comment-summary-in-pr: on-failure
48+
# OSI-approved permissive licenses; tighten/loosen to match policy.
49+
allow-licenses: >-
50+
Apache-2.0,
51+
BSD-2-Clause,
52+
BSD-3-Clause,
53+
ISC,
54+
MIT,
55+
MPL-2.0,
56+
CC-BY-4.0,
57+
CC0-1.0,
58+
Unlicense
59+
deny-licenses: >-
60+
AGPL-1.0-only,
61+
AGPL-1.0-or-later,
62+
AGPL-3.0-only,
63+
AGPL-3.0-or-later,
64+
GPL-2.0-only,
65+
GPL-3.0-only,
66+
LGPL-2.0-only,
67+
LGPL-3.0-only,
68+
SSPL-1.0
69+
# Block dependencies with active GitHub Security Advisories
70+
# in the npm/PyPI/Maven/etc. ecosystems regardless of severity.
71+
vulnerability-check: true
72+
license-check: true
73+
# Optional: warn (not fail) on these so they show in the PR summary.
74+
warn-only: false

0 commit comments

Comments
 (0)