Skip to content

feat(policy): Tier-2 permissions + trust_tiers schema, v1.1 (BRO-1600)#85

Merged
broomva merged 1 commit into
mainfrom
feature/bro-1600-policy-v2-schema
Jun 29, 2026
Merged

feat(policy): Tier-2 permissions + trust_tiers schema, v1.1 (BRO-1600)#85
broomva merged 1 commit into
mainfrom
feature/bro-1600-policy-v2-schema

Conversation

@broomva

@broomva broomva commented Jun 29, 2026

Copy link
Copy Markdown
Owner

What & why

Finishes the parked stash@{0} WIP — the Tier-2 schema slice of the indirect-prompt-injection defense (specs/2026-05-15-indirect-prompt-injection-defense.md). Schema-first: declares the capability/trust contract the runtime hooks pin to, mirroring how write_gate (Tier 1) landed schema-first ahead of its checker. The enforcement runtime is sequenced as separate follow-up PRs per spec §5 — not in this PR (and not over-reaching the L3 stability budget).

Closes BRO-1600.

Scope assessment (why this is the right slice)

Changes

  • assets/templates/policy.yaml.templateversion: "1.1" (additive; validates under policy.v1.jsonnot 2.0, which fails doctor's ^1\.[0-9]+$ without a whole v2-schema ecosystem). Adds:
    • permissions: path-based read/write/execute capability model + explicit precedence: deny_over_allow + never_auto_granted (7 caps) + signed grants.jsonl approval flow.
    • trust_tiers: self-contained T0–T4 instruction-authority classification (supersedes the spec's draft origin-locality sketch).
  • tests/policy-template-schema.test.sh — schema guard (parses, version, all v1.1 blocks, permissions sub-keys, trust_tiers, and a write_gate regression guard).
  • references/security-primitives.md — the model doc.
  • CHANGELOG + VERSION 0.28.1 → 0.29.0.

P20 adversarial verify (3 lenses) — found & fixed

The build+verify ran via a multi-agent workflow; the security/structural lenses caught real holes I then closed:

  • deny-precedence was unstated → added explicit precedence: deny_over_allow (load-bearing: {current_project}/** == {workspace_root}/** at root).
  • hooks:write unbacked.claude/settings.json + scripts/*-hook.sh + .githooks/** added to write.deny; hook scripts + grants.jsonl added to auto_merge.rules (require_human).
  • .control/trust-tiers.yaml was a writable security-control file → made trust_tiers self-contained in policy.yaml (protected by policy:write).
  • version 2.0 broke doctor1.1 (the structural lens ran the validator to confirm).
  • *.vercel.app egress wildcard (exfil channel) removed; out_of_band_discord enum-without-config dropped; bash allowlist/denylist annotated as defense-in-depth (the real exec boundary is deny-precedence + the Tier-3 sandbox).

Validation

  • bstack doctor: 100/100 (template validates against policy.v1.json).
  • Full tests/*.test.sh: 25/25 (incl. the new schema guard).
  • write_gate + editor-config gates confirmed intact (regression-guarded).

Follow-ups (out of scope, per spec §5)

Tier-2 runtime (hooks + permissions.py + webfetch-sanitizer) = PRs #3/#4; Tier 3 (sandbox + AI-commit trailer) #5/#6; Tier 4 (AgentDojo eval) #7. Relates BRO-1030.

🤖 Generated with Claude Code

…-1600)

Finishes the stashed Tier-2 schema slice of the indirect-prompt-injection defense
(specs/2026-05-15-indirect-prompt-injection-defense.md). Schema-first: declares the
capability/trust contract the runtime hooks pin to (matching write_gate's precedent);
the enforcement runtime is sequenced as separate follow-up PRs per spec §5.

policy.yaml.template:
- permissions: path-based read/write/execute capability model with explicit
  `precedence: deny_over_allow` (load-bearing self-elevation guard), never_auto_granted
  (7 caps), signed grants.jsonl approval flow.
- trust_tiers: self-contained T0-T4 instruction-authority classification (supersedes
  the spec's draft origin-locality sketch).
- version 1.0 -> 1.1 (additive; validates under policy.v1.json — NOT 2.0, which would
  fail doctor's ^1\.[0-9]+$ pattern without a whole v2-schema ecosystem).
- write_gate + editor-config gates kept intact (purely additive).

Adversarial verify (P20, 3 lenses) found + fixed: deny-precedence was unstated;
hooks:write / .claude/settings.json / .githooks now in write.deny + auto_merge
require_human; .control/grants.jsonl gated at merge; trust_tiers made self-contained
(protected by policy:write); *.vercel.app egress wildcard removed; out_of_band_discord
enum dropped.

+ tests/policy-template-schema.test.sh (schema guard; covers write_gate too)
+ references/security-primitives.md (model doc)
doctor: 100/100. Full tests/*.test.sh: 25/25.

Runtime + Tier 3/4 = follow-ups (spec §5). Relates BRO-1030.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@broomva, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 43 minutes and 9 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5d3ed945-b2d3-41d7-8abc-5cc0b578b869

📥 Commits

Reviewing files that changed from the base of the PR and between 1dc8492 and 4cc3c1d.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • VERSION
  • assets/templates/policy.yaml.template
  • references/security-primitives.md
  • tests/policy-template-schema.test.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bro-1600-policy-v2-schema

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@broomva broomva merged commit 39d100b into main Jun 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant