Skip to content

Commit b9da274

Browse files
author
Jonathan D.A. Jewell
committed
chore: Add comprehensive quality gates (RSR)
- CodeQL + SAST security scanning - OSSF Scorecard supply chain - Comprehensive quality (10 dimensions) - Technology-specific testing - Well-known enforcement - Dependabot updates
1 parent 0c6df09 commit b9da274

File tree

6 files changed

+424
-0
lines changed

6 files changed

+424
-0
lines changed

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
actions:
9+
patterns:
10+
- "*"
11+
12+
- package-ecosystem: "cargo"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
ignore:
17+
- dependency-name: "*"
18+
update-types: ["version-update:semver-patch"]
19+
20+
- package-ecosystem: "npm"
21+
directory: "/"
22+
schedule:
23+
interval: "weekly"
24+
25+
- package-ecosystem: "pip"
26+
directory: "/"
27+
schedule:
28+
interval: "weekly"

.github/workflows/codeql.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CodeQL Security Analysis
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
schedule:
8+
- cron: '0 6 * * 1'
9+
10+
jobs:
11+
analyze:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
language: ['javascript', 'python', 'go', 'java', 'ruby']
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Initialize CodeQL
23+
uses: github/codeql-action/init@v3
24+
with:
25+
languages: ${{ matrix.language }}
26+
queries: +security-and-quality
27+
continue-on-error: true
28+
29+
- name: Autobuild
30+
uses: github/codeql-action/autobuild@v3
31+
continue-on-error: true
32+
33+
- name: Perform Analysis
34+
uses: github/codeql-action/analyze@v3
35+
continue-on-error: true
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: Comprehensive Quality Gates
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
schedule:
7+
- cron: '0 5 * * 0'
8+
9+
jobs:
10+
# DEPENDABILITY - Stability and reliability
11+
dependability:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Check test coverage
16+
run: |
17+
echo "Checking for test files..."
18+
TESTS=$(find . -name "*_test.*" -o -name "test_*" -o -name "*_spec.*" -o -name "*.test.*" | wc -l)
19+
echo "Found $TESTS test files"
20+
if [ "$TESTS" -lt 1 ]; then
21+
echo "::warning::No test files detected"
22+
fi
23+
- name: Check error handling
24+
run: |
25+
# Check for proper error handling patterns
26+
PANICS=$(grep -rE "panic!|unwrap\(\)|expect\(" --include="*.rs" . 2>/dev/null | wc -l || echo "0")
27+
echo "Rust panics/unwraps: $PANICS"
28+
29+
# SECURITY - Multi-layer security scanning
30+
security:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Secret scanning
35+
uses: trufflesecurity/trufflehog@main
36+
continue-on-error: true
37+
- name: Dependency vulnerabilities
38+
run: |
39+
if [ -f "Cargo.toml" ]; then
40+
cargo install cargo-audit && cargo audit || true
41+
fi
42+
if [ -f "requirements.txt" ]; then
43+
pip install safety && safety check -r requirements.txt || true
44+
fi
45+
- name: SAST scan
46+
uses: returntocorp/semgrep-action@v1
47+
continue-on-error: true
48+
49+
# INTEROPERABILITY - API and format compatibility
50+
interoperability:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- name: Check API specs
55+
run: |
56+
if [ -f "openapi.yaml" ] || [ -f "openapi.json" ]; then
57+
echo "✅ OpenAPI spec found"
58+
fi
59+
if [ -f "schema.graphql" ]; then
60+
echo "✅ GraphQL schema found"
61+
fi
62+
- name: Validate JSON/YAML schemas
63+
run: |
64+
find . -name "*.json" -exec python3 -m json.tool {} \; 2>/dev/null | head -5 || true
65+
66+
# VALIDATION - Input/output validation
67+
validation:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
- name: Check for validation patterns
72+
run: |
73+
VALIDATION=$(grep -rE "validate|sanitize|Schema|Validator" --include="*.rs" --include="*.res" --include="*.ex" . 2>/dev/null | wc -l || echo "0")
74+
echo "Validation patterns found: $VALIDATION"
75+
76+
# ATTESTATION - Supply chain integrity (SLSA)
77+
attestation:
78+
runs-on: ubuntu-latest
79+
permissions:
80+
id-token: write
81+
contents: read
82+
attestations: write
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Generate SBOM
86+
run: |
87+
echo "SBOM generation would run here"
88+
# For Rust: cargo-sbom
89+
# For Node: npm sbom
90+
- name: Check signatures
91+
run: |
92+
if [ -f "CHECKSUMS.txt" ] || [ -f "SHA256SUMS" ]; then
93+
echo "✅ Checksums file present"
94+
fi
95+
96+
# VERIFICATION - Formal methods where applicable
97+
verification:
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v4
101+
- name: Check SPARK proofs
102+
run: |
103+
if find . -name "*.ads" | grep -q .; then
104+
echo "Ada/SPARK files found - formal verification applicable"
105+
fi
106+
- name: Type coverage
107+
run: |
108+
if [ -f "rescript.json" ]; then
109+
echo "ReScript provides 100% type coverage"
110+
fi
111+
112+
# FUNCTIONALITY - Feature completeness
113+
functionality:
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v4
117+
- name: Check TODOs and FIXMEs
118+
run: |
119+
echo "=== Incomplete items ==="
120+
grep -rn "TODO\|FIXME\|UNIMPLEMENTED\|unimplemented!" . 2>/dev/null | head -20 || echo "None"
121+
- name: Check deprecated usage
122+
run: |
123+
grep -rn "deprecated\|DEPRECATED" . 2>/dev/null | head -10 || echo "No deprecations"
124+
125+
# PERFORMANCE - Benchmarks and profiling
126+
performance:
127+
runs-on: ubuntu-latest
128+
steps:
129+
- uses: actions/checkout@v4
130+
- name: Check for benchmarks
131+
run: |
132+
BENCHES=$(find . -name "*bench*" -o -name "*perf*" | wc -l)
133+
echo "Benchmark files: $BENCHES"
134+
- name: Binary size check (Rust)
135+
run: |
136+
if [ -f "Cargo.toml" ]; then
137+
cargo build --release 2>/dev/null || true
138+
find target/release -maxdepth 1 -type f -executable -exec ls -lh {} \; 2>/dev/null || true
139+
fi
140+
141+
# ACCESSIBILITY - A11y compliance
142+
accessibility:
143+
runs-on: ubuntu-latest
144+
if: hashFiles('**/*.html') != ''
145+
steps:
146+
- uses: actions/checkout@v4
147+
- name: HTML accessibility check
148+
run: |
149+
echo "Checking for a11y attributes..."
150+
A11Y=$(grep -rE 'aria-|role=|alt=' --include="*.html" . 2>/dev/null | wc -l || echo "0")
151+
echo "A11y attributes found: $A11Y"
152+
- name: Lighthouse (if web project)
153+
run: |
154+
echo "Lighthouse would run on deployed URL"
155+
156+
# LICENSE COMPLIANCE
157+
license:
158+
runs-on: ubuntu-latest
159+
steps:
160+
- uses: actions/checkout@v4
161+
- name: Check license files
162+
run: |
163+
if [ -f "LICENSE" ] || [ -f "LICENSE.txt" ] || [ -f "LICENSE.md" ]; then
164+
echo "✅ License file present"
165+
head -5 LICENSE* 2>/dev/null
166+
else
167+
echo "::warning::No LICENSE file"
168+
fi
169+
- name: Check SPDX headers
170+
run: |
171+
SPDX=$(grep -rE "SPDX-License-Identifier" . 2>/dev/null | wc -l || echo "0")
172+
echo "Files with SPDX headers: $SPDX"
173+
174+
# DOCUMENTATION QUALITY
175+
documentation:
176+
runs-on: ubuntu-latest
177+
steps:
178+
- uses: actions/checkout@v4
179+
- name: Check docs completeness
180+
run: |
181+
DOCS=""
182+
[ -f "README.md" ] || [ -f "README.adoc" ] && DOCS="$DOCS README"
183+
[ -f "CONTRIBUTING.md" ] || [ -f "CONTRIBUTING.adoc" ] && DOCS="$DOCS CONTRIBUTING"
184+
[ -f "CHANGELOG.md" ] && DOCS="$DOCS CHANGELOG"
185+
[ -f "SECURITY.md" ] && DOCS="$DOCS SECURITY"
186+
[ -d "docs" ] && DOCS="$DOCS docs/"
187+
echo "Documentation:$DOCS"
188+
- name: Check code comments
189+
run: |
190+
COMMENTS=$(grep -rE "^[[:space:]]*(//|#|/\*)" --include="*.rs" --include="*.res" --include="*.py" . 2>/dev/null | wc -l || echo "0")
191+
echo "Comment lines: $COMMENTS"

.github/workflows/quality.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Code Quality
2+
on: [push, pull_request]
3+
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
10+
- name: Check file permissions
11+
run: |
12+
find . -type f -perm /111 -name "*.sh" | head -10 || true
13+
14+
- name: Check for secrets
15+
uses: trufflesecurity/trufflehog@main
16+
with:
17+
path: ./
18+
base: ${{ github.event.pull_request.base.sha || github.event.before }}
19+
head: ${{ github.sha }}
20+
continue-on-error: true
21+
22+
- name: Check TODO/FIXME
23+
run: |
24+
echo "=== TODOs ==="
25+
grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.rs" --include="*.res" --include="*.py" --include="*.ex" . | head -20 || echo "None found"
26+
27+
- name: Check for large files
28+
run: |
29+
find . -type f -size +1M -not -path "./.git/*" | head -10 || echo "No large files"
30+
31+
- name: EditorConfig check
32+
uses: editorconfig-checker/action-editorconfig-checker@main
33+
continue-on-error: true
34+
35+
docs:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Check documentation
40+
run: |
41+
MISSING=""
42+
[ ! -f "README.md" ] && [ ! -f "README.adoc" ] && MISSING="$MISSING README"
43+
[ ! -f "LICENSE" ] && [ ! -f "LICENSE.txt" ] && [ ! -f "LICENSE.md" ] && MISSING="$MISSING LICENSE"
44+
[ ! -f "CONTRIBUTING.md" ] && [ ! -f "CONTRIBUTING.adoc" ] && MISSING="$MISSING CONTRIBUTING"
45+
46+
if [ -n "$MISSING" ]; then
47+
echo "::warning::Missing docs:$MISSING"
48+
else
49+
echo "✅ Core documentation present"
50+
fi

.github/workflows/scorecard.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: OSSF Scorecard
2+
on:
3+
push:
4+
branches: [main, master]
5+
schedule:
6+
- cron: '0 4 * * 0'
7+
8+
permissions: read-all
9+
10+
jobs:
11+
analysis:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
persist-credentials: false
20+
21+
- name: Run Scorecard
22+
uses: ossf/[email protected]
23+
with:
24+
results_file: results.sarif
25+
results_format: sarif
26+
27+
- name: Upload results
28+
uses: github/codeql-action/upload-sarif@v3
29+
with:
30+
sarif_file: results.sarif

0 commit comments

Comments
 (0)