Skip to content

Commit fa42371

Browse files
author
Jonathan D.A. Jewell
committed
chore: Add RSR policy enforcement workflows
1 parent 2da77ed commit fa42371

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Guix/Nix Package Policy
2+
on: [push, pull_request]
3+
jobs:
4+
check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Enforce Guix primary / Nix fallback
9+
run: |
10+
# Check for package manager files
11+
HAS_GUIX=$(find . -name "*.scm" -o -name ".guix-channel" -o -name "guix.scm" 2>/dev/null | head -1)
12+
HAS_NIX=$(find . -name "*.nix" 2>/dev/null | head -1)
13+
14+
# Block new package-lock.json, yarn.lock, Gemfile.lock, etc.
15+
NEW_LOCKS=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E 'package-lock\.json|yarn\.lock|Gemfile\.lock|Pipfile\.lock|poetry\.lock|cargo\.lock' || true)
16+
if [ -n "$NEW_LOCKS" ]; then
17+
echo "⚠️ Lock files detected. Prefer Guix manifests for reproducibility."
18+
fi
19+
20+
# Prefer Guix, fallback to Nix
21+
if [ -n "$HAS_GUIX" ]; then
22+
echo "✅ Guix package management detected (primary)"
23+
elif [ -n "$HAS_NIX" ]; then
24+
echo "✅ Nix package management detected (fallback)"
25+
else
26+
echo "ℹ️ Consider adding guix.scm or flake.nix for reproducible builds"
27+
fi
28+
29+
echo "✅ Package policy check passed"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Security Policy
2+
on: [push, pull_request]
3+
jobs:
4+
check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Security checks
9+
run: |
10+
FAILED=false
11+
12+
# Block MD5/SHA1 for security (allow for checksums/caching)
13+
WEAK_CRYPTO=$(grep -rE 'md5\(|sha1\(' --include="*.py" --include="*.rb" --include="*.js" --include="*.ts" --include="*.go" --include="*.rs" . 2>/dev/null | grep -v 'checksum\|cache\|test\|spec' | head -5 || true)
14+
if [ -n "$WEAK_CRYPTO" ]; then
15+
echo "⚠️ Weak crypto (MD5/SHA1) detected. Use SHA256+ for security:"
16+
echo "$WEAK_CRYPTO"
17+
fi
18+
19+
# Block HTTP URLs (except localhost)
20+
HTTP_URLS=$(grep -rE 'http://[^l][^o][^c]' --include="*.py" --include="*.js" --include="*.ts" --include="*.go" --include="*.rs" --include="*.yaml" --include="*.yml" . 2>/dev/null | grep -v 'localhost\|127.0.0.1\|example\|test\|spec' | head -5 || true)
21+
if [ -n "$HTTP_URLS" ]; then
22+
echo "⚠️ HTTP URLs found. Use HTTPS:"
23+
echo "$HTTP_URLS"
24+
fi
25+
26+
# Block hardcoded secrets patterns
27+
SECRETS=$(grep -rEi '(api_key|apikey|secret_key|password)\s*[=:]\s*["\x27][A-Za-z0-9+/=]{20,}' --include="*.py" --include="*.js" --include="*.ts" --include="*.go" --include="*.rs" --include="*.env" . 2>/dev/null | grep -v 'example\|sample\|test\|mock\|placeholder' | head -3 || true)
28+
if [ -n "$SECRETS" ]; then
29+
echo "❌ Potential hardcoded secrets detected!"
30+
FAILED=true
31+
fi
32+
33+
if [ "$FAILED" = true ]; then
34+
exit 1
35+
fi
36+
37+
echo "✅ Security policy check passed"

.nojekyll

Whitespace-only changes.

0 commit comments

Comments
 (0)