Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 20 additions & 35 deletions satellites/milk-ssg/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
pull_request:
branches: [main]

env:
NODE_VERSION: '20'

jobs:
# ==========================================================================
# Language Enforcement - CRITICAL
Expand All @@ -36,12 +33,12 @@ jobs:
fi
echo "✅ Language enforcement passed: Only COW files in src/"

- name: Verify ReScript-only in adapters/
- name: Verify AffineScript-only in adapters/
run: |
echo "🔒 Enforcing ReScript-only policy in adapters/src/..."
forbidden=$(find adapters/src/ -type f ! -name "*.res" ! -name "*.resi" 2>/dev/null || true)
echo "🔒 Enforcing AffineScript-only policy in adapters/src/..."
forbidden=$(find adapters/src/ -type f ! -name "*.affine" 2>/dev/null || true)
if [ -n "$forbidden" ]; then
echo "❌ VIOLATION: Non-ReScript files found in adapters/src/:"
echo "❌ VIOLATION: Non-AffineScript files found in adapters/src/:"
echo "$forbidden"
exit 1
fi
Expand Down Expand Up @@ -88,7 +85,7 @@ jobs:
echo "📜 Checking SPDX headers..."
missing=0

for file in src/*.cow adapters/src/*.res; do
for file in src/*.cow adapters/src/*.affine; do
if [ -f "$file" ]; then
if ! head -5 "$file" | grep -q "SPDX-License-Identifier"; then
echo "❌ Missing SPDX header: $file"
Expand All @@ -115,7 +112,7 @@ jobs:
run: |
echo "🔐 Scanning for hardcoded secrets..."
if grep -rE "(password|api_key|secret_key|private_key)\s*=\s*['\"][^'\"]+['\"]" \
--include="*.res" --include="*.cow" --include="*.json" . 2>/dev/null | \
--include="*.affine" --include="*.cow" --include="*.json" . 2>/dev/null | \
grep -v "example" | grep -v "placeholder" | grep -v "node_modules"; then
echo "❌ Potential hardcoded secrets found"
exit 1
Expand All @@ -125,7 +122,7 @@ jobs:
- name: Verify adapter input sanitization
run: |
echo "🛡️ Checking adapter security..."
if ! grep -q "sanitizePath" adapters/src/MilkAdapter.res; then
if ! grep -q "sanitizePath" adapters/src/MilkAdapter.affine; then
echo "❌ Missing input sanitization in adapter"
echo "All user inputs MUST be validated before shell execution"
exit 1
Expand All @@ -136,42 +133,30 @@ jobs:
run: |
echo "🔍 Checking for command injection patterns..."
# Look for unsanitized template literals with execSync
if grep -E "execSync\s*\(\s*\`[^}]*\$\{[^}]*\}" adapters/src/MilkAdapter.res | \
if grep -E "execSync\s*\(\s*\`[^}]*\$\{[^}]*\}" adapters/src/MilkAdapter.affine | \
grep -v "sanitize"; then
echo "⚠️ Warning: Template literals in execSync - verify sanitization"
fi
echo "✅ Command injection check complete"

# ==========================================================================
# Adapter Build
# Adapter Check
# ==========================================================================
adapter-build:
name: Build Adapter
# The adapter is AffineScript (adapters/src/*.affine). There is no
# adapters/bun.lock yet, so no `bun install --frozen-lockfile` or build
# step runs here; add one once a lockfile is committed.
adapter-check:
name: Adapter Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: adapters/package-lock.json

- name: Install dependencies
working-directory: adapters
run: npm ci || npm install

- name: Build ReScript adapter
working-directory: adapters
run: npm run build

- name: Verify build output
- name: Verify AffineScript adapter source
run: |
if [ -f adapters/src/MilkAdapter.mjs ]; then
echo "✅ Adapter built successfully"
if [ -f adapters/src/MilkAdapter.affine ]; then
echo "✅ AffineScript adapter source present"
else
echo "❌ Adapter build output not found"
echo "❌ adapters/src/MilkAdapter.affine not found"
exit 1
fi

Expand Down Expand Up @@ -222,7 +207,7 @@ jobs:
ci-complete:
name: CI Complete
runs-on: ubuntu-latest
needs: [language-enforcement, syntax-check, spdx-check, security-check, adapter-build, e2e-test]
needs: [language-enforcement, syntax-check, spdx-check, security-check, adapter-check, e2e-test]
steps:
- name: All checks passed
run: |
Expand All @@ -232,5 +217,5 @@ jobs:
echo "✅ Syntax check: Valid COW commands"
echo "✅ SPDX headers: Present"
echo "✅ Security: No vulnerabilities detected"
echo "✅ Adapter: Built successfully"
echo "✅ Adapter: AffineScript source present"
echo "✅ E2E: Validation complete"
4 changes: 2 additions & 2 deletions satellites/milk-ssg/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ lint:
security:
@echo "🔒 Running security checks..."
@echo "Checking for secrets..."
@if grep -rE "(password|secret|api_key|token)\s*=" --include="*.res" --include="*.cow" . 2>/dev/null | grep -v "example" | head -1; then \
@if grep -rE "(password|secret|api_key|token)\s*=" --include="*.affine" --include="*.cow" . 2>/dev/null | grep -v "example" | head -1; then \
echo "⚠ Potential secrets found"; \
else \
echo "✓ No obvious secrets"; \
fi
@echo "Checking adapter for injection risks..."
@if grep -E "execSync\s*\(" adapters/src/MilkAdapter.res | grep -v sanitize; then \
@if grep -E "execSync\s*\(" adapters/src/MilkAdapter.affine | grep -v sanitize; then \
echo "⚠ execSync calls should use sanitized inputs"; \
else \
echo "✓ Command execution appears safe"; \
Expand Down
30 changes: 9 additions & 21 deletions satellites/terrapin-ssg/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbwhat else do you have on your roadmap going forward?e5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Check for secrets
run: |
Expand All @@ -107,8 +107,8 @@ jobs:
- name: Check adapter security
run: |
echo "🛡️ Checking adapter security..."
if [ -f adapters/src/TerrapinAdapter.res ]; then
if grep -q "allowedPatterns" adapters/src/TerrapinAdapter.res; then
if [ -f adapters/src/TerrapinAdapter.affine ]; then
if grep -q "allowedPatterns" adapters/src/TerrapinAdapter.affine; then
echo "✓ Pattern whitelist found in adapter"
else
echo "⚠ No pattern whitelist in adapter"
Expand Down Expand Up @@ -171,24 +171,12 @@ jobs:
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: '20'

- name: Check adapter dependencies
run: |
if [ -f adapters/package.json ]; then
echo "📦 Checking adapter dependencies..."
cd adapters
npm install --ignore-scripts
echo "✓ Adapter dependencies installed"
fi

- name: Verify ReScript files
# No adapters/bun.lock exists yet, so no `bun install --frozen-lockfile`
# step runs here; add one once a lockfile is committed.
- name: Verify AffineScript adapter
run: |
if [ -f adapters/src/TerrapinAdapter.res ]; then
echo "✓ ReScript adapter exists"
if [ -f adapters/src/TerrapinAdapter.affine ]; then
echo "✓ AffineScript adapter exists"
else
echo "⚠ ReScript adapter missing"
echo "⚠ AffineScript adapter missing"
fi
Loading