Skip to content

Commit c55006d

Browse files
ci: redistribute concurrency-cancel guard to read-only check workflows (#70)
* ci: redistribute canonical codeql.yml (concurrency-cancel guard) (Refs hyperpolymath/standards#122) * ci: redistribute canonical governance.yml (concurrency-cancel guard) (Refs hyperpolymath/standards#122) * ci: redistribute canonical scorecard-enforcer.yml (concurrency-cancel guard) (Refs hyperpolymath/standards#122) * ci: redistribute canonical scorecard.yml (concurrency-cancel guard) (Refs hyperpolymath/standards#122) * ci: redistribute canonical secret-scanner.yml (concurrency-cancel guard) (Refs hyperpolymath/standards#122)
1 parent 649a38d commit c55006d

4 files changed

Lines changed: 43 additions & 29 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# SPDX-License-Identifier: MPL-2.0
1+
# SPDX-License-Identifier: PMPL-1.0
22
name: CodeQL Security Analysis
33

44
on:
55
push:
6-
branches: [main]
6+
branches: [main, master]
77
pull_request:
8-
branches: [main]
8+
branches: [main, master]
99
schedule:
1010
- cron: '0 6 * * 1'
1111

@@ -30,22 +30,20 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
include:
33-
- language: rust
34-
build-mode: none
35-
- language: actions
33+
- language: javascript-typescript
3634
build-mode: none
3735

3836
steps:
3937
- name: Checkout
4038
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4139

4240
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@5e316336eb4f107009e477d4bfbfff13d7250fae # v4
41+
uses: github/codeql-action/init@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3
4442
with:
4543
languages: ${{ matrix.language }}
4644
build-mode: ${{ matrix.build-mode }}
4745

4846
- name: Perform CodeQL Analysis
49-
uses: github/codeql-action/analyze@5e316336eb4f107009e477d4bfbfff13d7250fae # v4
47+
uses: github/codeql-action/analyze@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3
5048
with:
5149
category: "/language:${{ matrix.language }}"

.github/workflows/scorecard-enforcer.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# SPDX-License-Identifier: MPL-2.0
2-
# Runs OpenSSF Scorecard and publishes findings to the scorecard webapp
3-
# + SARIF to Code Scanning. The strict numeric threshold gate was removed
4-
# because the SARIF output doesn't carry the overall score at any of the
5-
# obvious jq paths and a 5/10 threshold was arbitrary — findings are now
6-
# surfaced via Code Scanning instead.
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Prevention workflow - runs OpenSSF Scorecard and fails on low scores
73
name: OpenSSF Scorecard Enforcer
84

95
on:
@@ -43,25 +39,41 @@ jobs:
4339
publish_results: true
4440

4541
- name: Upload SARIF
46-
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4
42+
uses: github/codeql-action/upload-sarif@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4
4743
with:
4844
sarif_file: results.sarif
4945

50-
# Lightweight repo-hygiene gates that aren't part of the OSSF webapp publish.
46+
- name: Check minimum score
47+
run: |
48+
# Parse score from results
49+
SCORE=$(jq -r '.runs[0].tool.driver.properties.score // 0' results.sarif 2>/dev/null || echo "0")
50+
51+
echo "OpenSSF Scorecard Score: $SCORE"
52+
53+
# Minimum acceptable score (0-10 scale)
54+
MIN_SCORE=5
55+
56+
if [ "$(echo "$SCORE < $MIN_SCORE" | bc -l)" = "1" ]; then
57+
echo "::error::Scorecard score $SCORE is below minimum $MIN_SCORE"
58+
exit 1
59+
fi
60+
61+
# Check specific high-priority items
5162
check-critical:
5263
runs-on: ubuntu-latest
5364
steps:
5465
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5566

5667
- name: Check SECURITY.md exists
5768
run: |
58-
if [ ! -f "SECURITY.md" ] && [ ! -f ".github/SECURITY.md" ] && [ ! -f "docs/SECURITY.md" ]; then
59-
echo "::error::SECURITY.md is required (root, .github/, or docs/)"
69+
if [ ! -f "SECURITY.md" ]; then
70+
echo "::error::SECURITY.md is required"
6071
exit 1
6172
fi
6273
6374
- name: Check for pinned dependencies
6475
run: |
76+
# Check workflows for unpinned actions
6577
unpinned=$(grep -r "uses:.*@v[0-9]" .github/workflows/*.yml 2>/dev/null | grep -v "#" | head -5 || true)
6678
if [ -n "$unpinned" ]; then
6779
echo "::warning::Found unpinned actions:"

.github/workflows/scorecard.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: MPL-2.0
1+
# SPDX-License-Identifier: PMPL-1.0
22
name: OSSF Scorecard
33
on:
44
push:
@@ -15,7 +15,8 @@ concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}
1616
cancel-in-progress: true
1717

18-
permissions: read-all
18+
permissions:
19+
contents: read
1920

2021
jobs:
2122
analysis:
@@ -24,17 +25,17 @@ jobs:
2425
security-events: write
2526
id-token: write
2627
steps:
27-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
28+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2829
with:
2930
persist-credentials: false
3031

3132
- name: Run Scorecard
32-
uses: ossf/scorecard-action@99c09fe975337306107572b4fdf4db224cf8e2f2 # v2.4.3
33+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.3.1
3334
with:
3435
results_file: results.sarif
3536
results_format: sarif
3637

3738
- name: Upload results
38-
uses: github/codeql-action/upload-sarif@52485aec7be33610227643b0fe83936b8b5f061a # v3
39+
uses: github/codeql-action/upload-sarif@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3.31.8
3940
with:
4041
sarif_file: results.sarif

.github/workflows/secret-scanner.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: MPL-2.0
1+
# SPDX-License-Identifier: PMPL-1.0
22
# Prevention workflow - scans for hardcoded secrets before they reach main
33
name: Secret Scanner
44

@@ -21,14 +21,13 @@ permissions:
2121
jobs:
2222
trufflehog:
2323
runs-on: ubuntu-latest
24-
if: github.event_name == 'pull_request'
2524
steps:
26-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
2726
with:
2827
fetch-depth: 0 # Full history for scanning
2928

3029
- name: TruffleHog Secret Scan
31-
uses: trufflesecurity/trufflehog@37b77001d0174ebec2fcca2bd83ff83a6d45a3ab # v3
30+
uses: trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
3231
with:
3332
# The v3 action injects --fail automatically on pull_request events.
3433
# Passing --fail here triggers "flag 'fail' cannot be repeated".
@@ -37,7 +36,7 @@ jobs:
3736
gitleaks:
3837
runs-on: ubuntu-latest
3938
steps:
40-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
4140
with:
4241
fetch-depth: 0
4342

@@ -50,10 +49,14 @@ jobs:
5049
rust-secrets:
5150
runs-on: ubuntu-latest
5251
steps:
53-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
52+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
5453

5554
- name: Check for hardcoded secrets in Rust
5655
run: |
56+
if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then
57+
echo 'No Cargo.toml found — skipping Rust secrets check'
58+
exit 0
59+
fi
5760
# Patterns that suggest hardcoded secrets
5861
PATTERNS=(
5962
'const.*SECRET.*=.*"'

0 commit comments

Comments
 (0)