Skip to content

[AGENT-HOMES-001 PR-4] Per-machine capability grants (default deny) - #16

Closed
mfethe1 wants to merge 4 commits into
feature/agent-homes/pr3-machine-homesfrom
feature/agent-homes/pr4-capability-grants
Closed

mfethe1 wants to merge 4 commits into
feature/agent-homes/pr3-machine-homesfrom
feature/agent-homes/pr4-capability-grants

Conversation

@mfethe1

@mfethe1 mfethe1 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Stacks on #15 (PR-3). Base is the PR-3 branch — retarget to product/main after #15 merges.

What

The authorization half of agent homes: which agent may perform which capability against which target machine.

  • migrations/0048_agent_capability_grants.sql — tenant-scoped, community-fenced grant table
  • store/agent_capability_grants.rs — grant / revoke / is_granted / list_grants + impl Db methods
  • api/mod.rs::require_capability — relay-side gate returning 403 capability_not_granted
  • 2 new audit actions: capability_granted / capability_revoked

Design decisions

  • Default deny. Absence of a grant is a denial. is_granted returns false unless an active, non-revoked row exists.
  • Not relaxed by require_relay_membership. An open relay still denies ungranted cross-machine actions — unlike enforce_relay_membership, which no-ops on open relays. Cross-machine execution is a strictly higher bar than reading a relay.
  • Revocation is a tombstone, not a delete: revoked grants stay visible to list_grants and the audit trail. Re-granting reactivates the row.
  • Community-scoped throughout. A grant in one community never authorizes anything in another (test enforces this).

Verification (real Postgres, not mocks)

  • 8/8 store tests: default-deny, revoke round-trip, re-grant clears tombstone, wildcard target, no leak across capabilities, no leak across targets, community isolation, revoked-still-listed
  • 13/13 migration lint tests pass — including all_non_operator_global_tables_have_not_null_community_id and scoped_primary_key_..._lead_with_community_id, which validate the new table
  • buzz-audit round-trip test covers both new variants
  • fmt + clippy clean on buzz-db, buzz-audit, buzz-relay

Reviewer note

Sensitive-path (authz) → Path B, review required per AGENTS.md.

require_capability has no production call site yet — no cross-machine endpoint exists. I deliberately did not invent one; the gate lands with the model so the endpoint PR can consume it.

…ENT-HOMES-001 PR-4)

Adds the authorization half of agent homes: which agent may perform which
capability against which target machine. Stacks on PR-3 (#15).

Default deny: is_granted() returns false unless an active, non-revoked grant
exists. require_capability() in the relay API is NOT relaxed by
require_relay_membership -- an open relay still denies ungranted cross-machine
actions.

Revocation is a tombstone, not a delete, so revoked grants stay visible to
list_grants() and the audit trail. Re-granting reactivates.

Verified against real Postgres:
  8/8 agent_capability_grants store tests
  13/13 migration lint tests (tenant-scoping, fencing)
  buzz-audit action round-trip covers the 2 new variants
  fmt + clippy clean on buzz-db, buzz-audit, buzz-relay
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 5e23b817-20d5-4a29-8730-24707084acc4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@mfethe1
mfethe1 deleted the branch feature/agent-homes/pr3-machine-homes September 12, 2026 01:21
@mfethe1 mfethe1 closed this Sep 12, 2026
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