diff --git a/.claude/rules/security.md b/.claude/rules/security.md index 97bec4e..40effc2 100644 --- a/.claude/rules/security.md +++ b/.claude/rules/security.md @@ -11,17 +11,17 @@ This file states requirements. It does not, by itself, enforce them. Enforcement 3. **Hooks** (`.claude/hooks/*`) — deterministic guardrails, not a security boundary. This repo's hooks are **fail-open by design**: if `jq` is missing or input can't be parsed, the check is skipped and the tool call proceeds. See `docs/hooks.md` for the full security model. 4. **`permissions.deny` + CI** — boundaries. `permissions.deny` in `settings.json` cannot be overridden by any allow rule at any scope. CI checks (`.github/workflows/`) run outside the agent's control and block merges on failure. -Only the mechanically checkable items on this page have enforcement below step 1. The checklist states what must be true; it is the hooks, `permissions.deny` entries, and CI jobs cited in each line's parenthetical that actually verify it. +Only the mechanically checkable items on this page have enforcement below rung 1. The checklist below tags every line with its actual rung (1–4, matching the ladder above) and names the hook, `permissions.deny` entry, or CI job that verifies it; a rung-1 tag means prose only — nothing here mechanically checks it. ## Security Checklist -- [ ] No hardcoded secrets or credentials (enforced via `pre-tool-use-validator.sh` hook secret detection + CI secret-scan job, Trivy `fs --scanners secret`, blocking) -- [ ] All user input is validated and sanitized (enforce via input validation middleware) -- [ ] SQL queries use parameterized statements -- [ ] Authentication and authorization are properly implemented -- [ ] Sensitive data is encrypted at rest and in transit -- [ ] Error messages don't expose internal details -- [ ] Dependencies are up to date and vulnerability-free (enforce via automated dependency scanning) +- [ ] No hardcoded secrets or credentials (rung 3+4 — enforced via `pre-tool-use-validator.sh` hook secret detection across Write/Edit content and Bash redirects/heredocs, plus CI secret-scan job, Trivy `fs --scanners secret,vuln`, blocking) +- [ ] All user input is validated and sanitized (rung 1 — adopter-level: enforce in your application/CI; this framework cannot check it) +- [ ] SQL queries use parameterized statements (rung 1 — adopter-level: enforce in your application/CI; this framework cannot check it) +- [ ] Authentication and authorization are properly implemented (rung 1 — adopter-level: enforce in your application/CI; this framework cannot check it) +- [ ] Sensitive data is encrypted at rest and in transit (rung 1 — adopter-level: enforce in your application/CI; this framework cannot check it) +- [ ] Error messages don't expose internal details (rung 1 — adopter-level: enforce in your application/CI; this framework cannot check it) +- [ ] Dependencies are up to date and vulnerability-free (rung 4 — enforced via this repo's own Trivy `fs --scanners secret,vuln` CI job, blocking (trivially green today: no dependency manifests exist in this repo); every stack pack ships a matching native audit gate — `pnpm audit --audit-level high` / `uvx pip-audit` / `govulncheck ./...` / `cargo audit` in `.claude/templates/stack-packs/*/ci-gates.yml` — reaching the same CI rung in an adopter's own repo once merged) ## Data Routing diff --git a/.claude/templates/stack-packs/go/ci-gates.yml b/.claude/templates/stack-packs/go/ci-gates.yml index 3465685..df8f702 100644 --- a/.claude/templates/stack-packs/go/ci-gates.yml +++ b/.claude/templates/stack-packs/go/ci-gates.yml @@ -19,6 +19,9 @@ gates: - uses: golangci/golangci-lint-action@v9.3.0 with: version: v2.12 + # dependency scan — .claude/rules/security.md Dependency Safety + - run: go install golang.org/x/vuln/cmd/govulncheck@latest + - run: govulncheck ./... - run: go test ./... - run: go vet ./... - run: go build ./... diff --git a/.claude/templates/stack-packs/go/golden-path.skill.md b/.claude/templates/stack-packs/go/golden-path.skill.md index 6358ee2..532e233 100644 --- a/.claude/templates/stack-packs/go/golden-path.skill.md +++ b/.claude/templates/stack-packs/go/golden-path.skill.md @@ -34,7 +34,7 @@ Regenerate `go.sum` with `go mod tidy` after every dependency change — never h ## Gates Wiring -`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `go.mod` and reminds you to run these commands before a commit lands. CI runs the identical gates — see this pack's `ci-gates.yml`. +`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `go.mod` and reminds you to run these commands before a commit lands. CI runs the same gates plus a dependency-audit step (`govulncheck ./...`) that has no local pre-commit equivalent — see this pack's `ci-gates.yml`. ## Related Skills diff --git a/.claude/templates/stack-packs/python/ci-gates.yml b/.claude/templates/stack-packs/python/ci-gates.yml index a3d52f7..6459017 100644 --- a/.claude/templates/stack-packs/python/ci-gates.yml +++ b/.claude/templates/stack-packs/python/ci-gates.yml @@ -15,6 +15,8 @@ gates: with: enable-cache: true - run: uv sync --locked + # dependency scan — .claude/rules/security.md Dependency Safety + - run: uvx pip-audit - run: uv run pytest - run: uv run ruff check . - run: uv run ruff format --check . diff --git a/.claude/templates/stack-packs/python/golden-path.skill.md b/.claude/templates/stack-packs/python/golden-path.skill.md index cd587b2..4f9fc70 100644 --- a/.claude/templates/stack-packs/python/golden-path.skill.md +++ b/.claude/templates/stack-packs/python/golden-path.skill.md @@ -33,7 +33,7 @@ Regenerate `uv.lock` with `uv lock` (`uv sync` regenerates it implicitly too) ## Gates Wiring -`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `pyproject.toml` and reminds you to run these commands before a commit lands. CI runs the identical four gates — see this pack's `ci-gates.yml`. +`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `pyproject.toml` and reminds you to run these commands before a commit lands. CI runs the same four gates plus a dependency-audit step (`uvx pip-audit`) that has no local pre-commit equivalent — see this pack's `ci-gates.yml`. ## Related Skills diff --git a/.claude/templates/stack-packs/rust/ci-gates.yml b/.claude/templates/stack-packs/rust/ci-gates.yml index e235126..2480279 100644 --- a/.claude/templates/stack-packs/rust/ci-gates.yml +++ b/.claude/templates/stack-packs/rust/ci-gates.yml @@ -15,6 +15,8 @@ gates: - uses: actions-rust-lang/setup-rust-toolchain@v1.17.0 with: components: clippy, rustfmt + - run: cargo install cargo-audit --locked # dependency scan — .claude/rules/security.md Dependency Safety + - run: cargo audit # vulnerability audit - run: cargo test # test suite - run: cargo clippy # lint - run: cargo fmt --check # format check diff --git a/.claude/templates/stack-packs/rust/golden-path.skill.md b/.claude/templates/stack-packs/rust/golden-path.skill.md index ae5ac42..d35c20a 100644 --- a/.claude/templates/stack-packs/rust/golden-path.skill.md +++ b/.claude/templates/stack-packs/rust/golden-path.skill.md @@ -34,7 +34,7 @@ Cargo regenerates `Cargo.lock` automatically on any command that resolves depend ## Gates Wiring -`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `Cargo.toml` and reminds you to run these commands before a commit lands. CI runs the identical gates — see this pack's `ci-gates.yml`. +`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `Cargo.toml` and reminds you to run these commands before a commit lands. CI runs the same gates plus a dependency-audit step (`cargo audit`) that has no local pre-commit equivalent — see this pack's `ci-gates.yml`. ## Related Skills diff --git a/.claude/templates/stack-packs/typescript/ci-gates.yml b/.claude/templates/stack-packs/typescript/ci-gates.yml index 53bfdb4..2e1aec4 100644 --- a/.claude/templates/stack-packs/typescript/ci-gates.yml +++ b/.claude/templates/stack-packs/typescript/ci-gates.yml @@ -16,6 +16,7 @@ gates: node-version: lts/* cache: pnpm - run: pnpm install --frozen-lockfile + - run: pnpm audit --audit-level high # dependency scan — .claude/rules/security.md Dependency Safety - run: pnpm test # vitest run - run: pnpm lint # biome check . - run: pnpm typecheck # tsc --noEmit diff --git a/.claude/templates/stack-packs/typescript/golden-path.skill.md b/.claude/templates/stack-packs/typescript/golden-path.skill.md index 53a9b9d..ba9373d 100644 --- a/.claude/templates/stack-packs/typescript/golden-path.skill.md +++ b/.claude/templates/stack-packs/typescript/golden-path.skill.md @@ -34,7 +34,7 @@ Regenerate `pnpm-lock.yaml` with `pnpm install` — never hand-edit it. Commit i ## Gates Wiring -`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `package.json` and reminds you to run these commands before a commit lands. CI runs the identical four gates — see this pack's `ci-gates.yml`. +`.claude/hooks/pre-commit-verification.sh` auto-detects this stack from `package.json` and reminds you to run these commands before a commit lands. CI runs the same four gates plus a dependency-audit step (`pnpm audit --audit-level high`) that has no local pre-commit equivalent — see this pack's `ci-gates.yml`. ## Related Skills diff --git a/.github/workflows/framework-invariants.yml b/.github/workflows/framework-invariants.yml index c5ce752..cb69c90 100644 --- a/.github/workflows/framework-invariants.yml +++ b/.github/workflows/framework-invariants.yml @@ -59,7 +59,8 @@ jobs: uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 (SHA-pins its own setup-trivy dependency; older releases referenced since-deleted setup-trivy tags) with: scan-type: fs - scanners: secret + # No manifests exist in this repo today, so vuln findings are trivially green here — the scanner is real for forks/adopters that add them. + scanners: secret,vuln exit-code: 1 diff-size: diff --git a/CHANGELOG.md b/CHANGELOG.md index 42a2bf4..8258419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `pre-commit-verification.sh` rewritten from advisory-only to enforcing (jq present): on `git commit`, runs every gate `gate-lib.sh` detects, each under `timeout "${CLAUDE_GATE_TIMEOUT_SECS:-120}"` from the project dir, logging to `.claude/hooks/.state/gate-