-
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (113 loc) · 3.81 KB
/
Copy pathsecurity-checks.yml
File metadata and controls
114 lines (113 loc) · 3.81 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
# 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:
contents: read
jobs:
secret-scanning:
name: Detect Secrets
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Detect secrets with Gitleaks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event_name == 'pull_request'
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Dependency Review
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.5.0
with:
fail-on-severity: high
deny-licenses: GPL-3.0, AGPL-3.0
comment-summary-in-pr: always
validate-actions:
name: Validate GitHub Actions
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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"
trufflehog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
fetch-depth: 0
- name: TruffleHog Secret Scan
uses: trufflesecurity/trufflehog@main
with:
extra_args: --only-verified --fail