Skip to content

governance: pattern-based Ask rules and a layered permissions.toml - #192

Merged
github-actions[bot] merged 1 commit into
mainfrom
hitl-pattern-rules-and-permissions-file
Aug 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
hitl-pattern-rules-and-permissions-file

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • Phase 2 of the HITL/permission-model redesign (see docs/hitl-permission-model-research.md).
  • Adds tool(pattern) pattern rules (crates/forge-governance/src/pattern.rs) matched against the actual call — command prefix for shell tools, path glob for file tools, host for fetch-style tools (e.g. bash(cargo test *), write_file(src/**), fetch(*.example.com)).
  • These rules only narrow an already-gated call between Hitl and Allow. AclPolicy deny still wins first, unconditionally — a pattern rule can never turn a call into Deny, and has no effect on a tool that wasn't gated in the first place.
  • pattern_deny lets a narrower rule carve an exception out of a broader pattern_allow (e.g. allow cargo * but keep asking for cargo publish).
  • Backed by a layered permissions.toml (crates/forge-config/src/permissions.rs): a personal file under the user config directory, and a repo-committed .forge/permissions.toml.
  • Safety-motivated asymmetry: the repo-scope file's allow entries are always ignored (with a diagnostic explaining why) — a checked-out, possibly-untrusted repo shouldn't be able to grant itself a wider blast radius than a human approved personally. This mirrors the README's existing restriction on project-discovered MCP server config. The repo file's deny entries are always honored, since tightening approval is safe regardless of source.
  • Wired into forge-cli's startup (open_session) so Governance is actually built from the merged file at launch, not just parsed and discarded.
  • README.md documents the new file and precedence under a new "Permission rules" section.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo test --workspace --all-targets --locked (0 failures across all 18 crates)
  • New tests: pattern parsing/matching (forge-governance/src/pattern.rs), authorize() narrowing/deny-carve-out/no-op-on-ungated-tool/cannot-override-ACL-deny (forge-governance/src/lib.rs), file loading/merging/repo-allow-rejection/append-dedup (forge-config/src/permissions.rs), and an end-to-end wiring test in forge-cli/src/main.rs.

Add tool(pattern) rules that narrow an already-gated call (command prefix
for shell tools, path glob for file tools, host for fetch-style tools)
between Hitl and Allow. Deny still wins first, unconditionally, and a
pattern rule can never turn a call into Deny — it's strictly a narrowing
of the space between "always ask" and "never ask".

Rules are backed by a layered permissions.toml: a personal file under the
user config directory and a repo-committed .forge/permissions.toml. The
repo file's `allow` entries are never honored — a checked-out repository
can't grant itself a wider blast radius than a human approved locally,
mirroring the existing restriction on project-discovered MCP config. Its
`deny` entries are always honored, since narrowing approval is safe
regardless of source.

Wired into forge-cli's startup so Governance is actually configured from
the merged file at launch.

Phase 2 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
@github-actions
github-actions Bot enabled auto-merge (squash) August 3, 2026 06:31
@github-actions
github-actions Bot merged commit b1eb00d into main Aug 3, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
…oml (#192)

Add tool(pattern) rules that narrow an already-gated call (command prefix
for shell tools, path glob for file tools, host for fetch-style tools)
between Hitl and Allow. Deny still wins first, unconditionally, and a
pattern rule can never turn a call into Deny — it's strictly a narrowing
of the space between "always ask" and "never ask".

Rules are backed by a layered permissions.toml: a personal file under the
user config directory and a repo-committed .forge/permissions.toml. The
repo file's `allow` entries are never honored — a checked-out repository
can't grant itself a wider blast radius than a human approved locally,
mirroring the existing restriction on project-discovered MCP config. Its
`deny` entries are always honored, since narrowing approval is safe
regardless of source.

Wired into forge-cli's startup so Governance is actually configured from
the merged file at launch.

Phase 2 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
mohitranka added a commit that referenced this pull request Sep 11, 2026
…oml (#192)

Add tool(pattern) rules that narrow an already-gated call (command prefix
for shell tools, path glob for file tools, host for fetch-style tools)
between Hitl and Allow. Deny still wins first, unconditionally, and a
pattern rule can never turn a call into Deny — it's strictly a narrowing
of the space between "always ask" and "never ask".

Rules are backed by a layered permissions.toml: a personal file under the
user config directory and a repo-committed .forge/permissions.toml. The
repo file's `allow` entries are never honored — a checked-out repository
can't grant itself a wider blast radius than a human approved locally,
mirroring the existing restriction on project-discovered MCP config. Its
`deny` entries are always honored, since narrowing approval is safe
regardless of source.

Wired into forge-cli's startup so Governance is actually configured from
the merged file at launch.

Phase 2 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
mohitranka added a commit that referenced this pull request Sep 11, 2026
…oml (#192)

Add tool(pattern) rules that narrow an already-gated call (command prefix
for shell tools, path glob for file tools, host for fetch-style tools)
between Hitl and Allow. Deny still wins first, unconditionally, and a
pattern rule can never turn a call into Deny — it's strictly a narrowing
of the space between "always ask" and "never ask".

Rules are backed by a layered permissions.toml: a personal file under the
user config directory and a repo-committed .forge/permissions.toml. The
repo file's `allow` entries are never honored — a checked-out repository
can't grant itself a wider blast radius than a human approved locally,
mirroring the existing restriction on project-discovered MCP config. Its
`deny` entries are always honored, since narrowing approval is safe
regardless of source.

Wired into forge-cli's startup so Governance is actually configured from
the merged file at launch.

Phase 2 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
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