feat(policy): Tier-2 permissions + trust_tiers schema, v1.1 (BRO-1600)#85
Conversation
…-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>
|
Warning Review limit reached
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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 howwrite_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)
write_gate+ editor-config gates) already shipped to HEAD — kept intact (purely additive).permission-gate-hook.sh,read-boundary-hook.sh,permissions.py,webfetch-sanitizer.py) — all absent; the spec's "already prototyped" was aspirational. Sequenced as PRs feat(bstack): doctor extends to P11 (Empirical Feedback Loop) #3/feat(bstack): rewrite SKILL.md per skill-creator + scaffold/wire/doctor pipeline #4.permissions:+trust_tiers:schema.Changes
assets/templates/policy.yaml.template→version: "1.1"(additive; validates underpolicy.v1.json— not2.0, which failsdoctor's^1\.[0-9]+$without a whole v2-schema ecosystem). Adds:permissions: path-based read/write/execute capability model + explicitprecedence: deny_over_allow+never_auto_granted(7 caps) + signedgrants.jsonlapproval 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,permissionssub-keys,trust_tiers, and awrite_gateregression guard).references/security-primitives.md— the model doc.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:
precedence: deny_over_allow(load-bearing:{current_project}/**=={workspace_root}/**at root).hooks:writeunbacked →.claude/settings.json+scripts/*-hook.sh+.githooks/**added towrite.deny; hook scripts +grants.jsonladded toauto_merge.rules(require_human)..control/trust-tiers.yamlwas a writable security-control file → madetrust_tiersself-contained inpolicy.yaml(protected bypolicy:write).2.0brokedoctor→1.1(the structural lens ran the validator to confirm).*.vercel.appegress wildcard (exfil channel) removed;out_of_band_discordenum-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 againstpolicy.v1.json).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