-
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (126 loc) · 4.57 KB
/
Copy pathsecurity-checks.yml
File metadata and controls
139 lines (126 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# SPDX-License-Identifier: MPL-2.0
# RSR-compliant security validation workflow with SHA-pinned actions
name: Security Checks
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions: read-all
jobs:
secret-scanning:
name: Detect Secrets
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Detect secrets with Gitleaks
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v2.3.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Dependency Review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v4.5.0
with:
fail-on-severity: high
# Replaces the previous `deny-licenses: GPL-3.0, AGPL-3.0`. The
# `deny-licenses` option is deprecated for removal in the next
# major release (actions/dependency-review-action#997): when no
# SBOM is available it can't actually evaluate a denylist, so it
# fails-open silently. `allow-licenses` fails-closed: anything
# not on this list (including the strong-copyleft GPL-3.0 /
# AGPL-3.0 we want to keep out) blocks the PR.
#
# Scope: permissive + weak-copyleft licenses compatible with this
# repo's PMPL distribution. Adjust if a legitimate dep gets
# blocked — do NOT slip GPL-3.0 / AGPL-3.0 back in.
allow-licenses: >-
Apache-2.0,
BSD-2-Clause,
BSD-3-Clause,
BSD-3-Clause-Clear,
CC0-1.0,
ISC,
LGPL-2.1-only,
LGPL-2.1-or-later,
LGPL-3.0-only,
LGPL-3.0-or-later,
MIT,
MPL-2.0,
PSF-2.0,
Python-2.0,
Unlicense,
Zlib
comment-summary-in-pr: always
validate-actions:
name: Validate GitHub Actions
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check for unpinned actions
run: |
echo "Checking for unpinned GitHub Actions..."
UNPINNED=$(grep -rE "uses:\s+[^@]+@(v[0-9]+|main|master|latest)" .github/workflows/ || true)
if [ -n "$UNPINNED" ]; then
echo "::warning::Found potentially unpinned actions (should use SHA pinning):"
echo "$UNPINNED"
else
echo "All actions appear to be SHA-pinned"
fi
- name: Check for dangerous permissions
run: |
echo "Checking for overly permissive workflow permissions..."
DANGEROUS=$(grep -rE "permissions:\s*write-all" .github/workflows/ || true)
if [ -n "$DANGEROUS" ]; then
echo "::error::Found workflows with write-all permissions:"
echo "$DANGEROUS"
exit 1
fi
echo "No dangerous permissions found"
file-validation:
name: Validate Security Files
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check required security files exist
run: |
MISSING=""
for file in SECURITY.md LICENSE.txt .github/CODEOWNERS .github/dependabot.yml; do
if [ ! -f "$file" ]; then
MISSING="$MISSING $file"
fi
done
if [ -n "$MISSING" ]; then
echo "::error::Missing required security files:$MISSING"
exit 1
fi
echo "All required security files present"
- name: Check for template placeholders
run: |
echo "Checking for unfilled template placeholders..."
PLACEHOLDERS=$(grep -rE "\{\{[A-Z_]+\}\}" SECURITY.md CONTRIBUTING.md 2>/dev/null || true)
if [ -n "$PLACEHOLDERS" ]; then
echo "::error::Found unfilled template placeholders:"
echo "$PLACEHOLDERS"
exit 1
fi
echo "No template placeholders found"