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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Please choose versions by [Semantic Versioning](http://semver.org/).

## Unreleased

- feat: Ship the comprehensive security v1 rule base in `docs/security/security-review-guide.md` — 7 judgment-tier rules (SSRF, XSS, deserialization, open redirect, webhook verification MUST; mass assignment, insecure defaults SHOULD) and 2 invariant-linked authz rules (resource ownership, tenant isolation MUST) with `**Class**: security-invariant` and `@commits` triggers; extend `scripts/build-index.py` to emit a `class` index key and document the new field in `docs/rule-block-schema.md`; regenerate `rules/index.json` from 171 to 180 entries; record the cross-language detector layout decision (per-language `rules/security/{go,python,node}/` target, go-first v1 stays flat)
- fix: `/coding:commit` § 2d — document that untracked files must be `git add`-ed before the pathspec commit; a commit pathspec matches only tracked paths, so every commit introducing a new file failed with `did not match any file(s) known to git`

## v0.49.0
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Each enforceable guide in `docs/` should have a matching agent in `agents/`. The
| `go-doc-best-practices.md` | `godoc-assistant` |
| `go-testing-guide.md` | `go-test-quality-assistant` |
| `go-security-linting.md` | `go-security-specialist` |
| `security-review-guide.md` | `go-security-specialist` (rule-base owner for the mechanical security detectors in `rules/security/`) |
| `security-review-guide.md` | `go-security-specialist` (rule-base owner for the comprehensive security rule base — mechanical detectors, judgment rules, invariant-linked authz rules) |
| `go-licensing-guide.md` | `license-assistant` |
| `agent-command-development-guide.md` | `agent-auditor` + `slash-command-auditor` |
| `claude-code-skill-writing-guide.md` | `skill-auditor` |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ All guides live in [`docs/`](docs/) and can be read standalone without the plugi
| [Replace Directive](docs/go-mod-replace-guide.md) | When to use `replace` in go.mod |
| [Linting](docs/go-linting-guide.md) | Static analysis |
| [Security Linting](docs/go-security-linting.md) | Security analysis |
| [Security Review Guide](docs/security/security-review-guide.md) | Mechanical security rule base |
| [Security Review Guide](docs/security/security-review-guide.md) | Comprehensive security rule base (mechanical, judgment, invariant tiers) |
| [Security Review Pipeline](docs/security/security-review-pipeline.md) | Per-review evidence-pointered security model derivation (entry points, resources, invariants) |
| [Kubernetes CRD Controller](docs/go-kubernetes-crd-controller-guide.md) | CRD types, informer, self-install |
| [Kubernetes Manifest Layout](docs/k8s-manifest-guide.md) | `k8s/` folder, filename suffixes, templating |
Expand Down
32 changes: 24 additions & 8 deletions docs/rule-block-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,21 @@ Judgment-tier rules carry a `**Trigger**:` field immediately after `**Enforcemen
- Missing `Trigger` field → `trigger` key omitted from the index entry (no scoping applied).
- All judgment-tier rules MUST have a `Trigger` field. Mechanical and script rules omit it (they are always run by the funnel unconditionally).

### Optional Field: Class

A small set of judgment-tier RULE blocks carry a `**Class**:` field immediately after `**Trigger**:` (or immediately after `**Enforcement**:` when no Trigger is present). The walker indexes it as a `class` string in `rules/index.json`. The dispatcher uses it to scope which owner agents consume which judgment tier — invariant-linked rules (`class: security-invariant`) require the derived session security model to fire and are scoped by `**Trigger**: @commits`.

```markdown
**Class**: <token>
```

- v1 token: `security-invariant`. Marks a rule that requires whole-repo reasoning against the derived session security model (see `docs/security/security-review-pipeline.md`).
- Missing `**Class**:` field → `class` key omitted from the index entry (no scoping applied).
- All judgment-tier rules MAY carry a Class; mechanical and script rules omit it.

### Recommended Field: `Why`

Most rule blocks in this repo carry a `**Why**:` paragraph immediately after `**Enforcement**:`. The `Why` is not indexed (the walker ignores it) but is highly recommended as the *only* place the rule's rationale lives — it tells future authors, agents, and bot reviewers *what failure mode this rule prevents*, which is what makes the rule defensible during code review.
Most rule blocks in this repo carry a `**Why**:` paragraph immediately after the field block (after `**Enforcement**:`, and after `**Trigger**:` / `**Class**:` where present). The `Why` is not indexed (the walker ignores it) but is highly recommended as the *only* place the rule's rationale lives — it tells future authors, agents, and bot reviewers *what failure mode this rule prevents*, which is what makes the rule defensible during code review.

```markdown
**Why**: <one or two sentences explaining the failure mode this rule prevents
Expand Down Expand Up @@ -104,20 +116,24 @@ The index is a JSON array of rule entries. Top-level key is an array; entries ar
| `enforcement` | string | **Enforcement**: field | Copied verbatim |
| `enforcement_type` | string | Derived from `enforcement` | `mechanical` (cites `rules/<lang>/<slug>.yml`), `script` (cites `scripts/rule-checks.sh`), or `judgment` (neither) |
| `trigger` | array of strings | Optional **Trigger**: field | Glob patterns; present only when the doc block includes a `**Trigger**:` line. `@commits` is a special value meaning "always active for PR commit review". Missing = no dispatcher-level scoping (owner runs whenever invoked). |
| `class` | string | Optional **Class**: field | Present only when the doc block includes a `**Class**:` line. v1 value: `security-invariant`. |

JSON object keys are alphabetically sorted in output.

Example entry:

```json
{
"id": "go/context-cancel-in-loop",
"level": "SHOULD",
"doc_path": "docs/go-context-cancellation-in-loops.md",
"anchor": "go/context-cancel-in-loop",
"owner": "go-context-assistant",
"applies_when": "Go for loop body lacks a non-blocking select { case <-ctx.Done(): ...; default: } check, outside *_test.go and vendor/.",
"enforcement": "rules/go/cancel-check-in-loop.yml (mechanical flag) + judgment-tier LLM adjudication for long-running enough to matter."
"id": "go-security/resource-ownership",
"level": "MUST",
"doc_path": "docs/security/security-review-guide.md",
"anchor": "go-security/resource-ownership",
"owner": "go-security-specialist",
"applies_when": "A handler reads a resource addressed by a path parameter without first verifying the authenticated user owns it.",
"enforcement": "judgment — LLM adjudicator resolves the resource's authorization_functions from the derived session security model per docs/security/security-review-pipeline.md.",
"enforcement_type": "judgment",
"trigger": ["@commits"],
"class": "security-invariant"
}
```

Expand Down
Loading
Loading