Awesome Reviewers

All security-relevant authorization/receipt logic must be (1) scope-correct and precondition-correct, and (2) fed only strictly validated/sanitized inputs—especially when values are used to render/parse audit logs, build regexes, or mutate the filesystem.

Rules to apply 1) Don’t let global state “prove” per-entity review

2) Protect authority-bearing events and gates

3) Validate audit/event fields to prevent injection/forgery

4) Validate identifiers against the authoritative model

5) Escape or avoid dynamic regex construction

6) Guard destructive filesystem operations in CLI

Example patterns

function locateAnchor(content: string, anchor: string): number { if (!/^after-step:\d+$/.test(anchor)) return -1; // strict grammar const n = anchor.slice(“after-step:”.length); const re = new RegExp(^### Step ${escapeRegExp(n)}\\b.*$, “m”); // … use re }

- OutDir guard for destructive builds:
```ts
if (existsSync(outDir) && readdirSync(outDir).length > 0) {
  const marker = join(outDir, "<projection-marker>");
  if (!existsSync(marker) && !argv.includes("--force")) {
    throw new Error("Refusing to delete non-projection outDir; use --force");
  }
}

Impact Following this standard prevents: scope confusion in receipt verification, authority forgery via audit parsing quirks, regex-based mis-parsing/splicing, state corruption from unsafe identifiers, and accidental/hostile filesystem deletion—directly addressing the security risks raised in these discussions.