// COMPLETE REFERENCE

Consent system

Chapter 757 4 min read English Stable reference URL

Reference for the per-person consent gate that sits between an agent turn and a suite application. Reader-facing behaviour (what the card asks, what each button means) is in Approving what the assistant does.

Authority: botserver/crates/botconsent/ (feature consent, present in all-apps and gblite), the process-wide gate in botserver/src/core/bot/consent_gate.rs, and migration 6.5.87-app-permissions.

Enforcement points

The gate is not a UI feature: executors call it before performing an action. consent_gate::check_with_context is the single entry point (consent_gate.rs:64-132); when the consent service was never initialised the gate returns allowed: true, which is the documented legacy behaviour for builds without the feature.

Caller What it gates Source
Chat command path (__api_call__) every API command the model invokes pipeline/api_call/handle.rs:190-240
api/ui loopback executor agent calls into the app fragments core/bot/api_exec.rs:207
Code execution scripted app commands core/bot/runs/code_exec/consent.rs:115
Agent VM in-container and out-of-container actions pipeline/vm_consent/gate.rs:47,150

Manual use of the applications by the signed-in person is never gated.

The matrix

A grant is a row in app_permissions, keyed by (user_id, app_id, action_class) (store::grant, store.rs:105-145). There is no coarse “user × app” switch.

Action classes

models.rs:18-22 defines the classes; an unknown class is denied and audited (authorize.rs:44-46).

Group Classes Risk tier
Ordinary application work read, create, update, delete, payment, share, publish low / medium / high
Agent VM, inside the container vm_command, vm_file_read, vm_file_write, vm_file_delete, vm_network, vm_browser medium, vm_file_delete high
Agent VM, sending data out vm_drive_save, vm_external_save high
Conversation-wide VM grant vm_all high

vm_all covers the in-container classes only; the two outbound classes always need their own decision (models.rs:27-33).

Decisions and lifetimes

Decision (models.rs:166-184) is richer than three buttons:

Decision Persisted scope Lifetime
allow_once none — held in an in-memory approved map one call
allow_run run 6 hours
allow_workspace workspace 1 hour
allow_conversation conversation 24 hours, tied to the asking thread
always always no expiry
allow_all conversation with class rewritten to vm_all 24 hours
deny recorded in the audit trail —

ConsentScope::lifetime_secs (models.rs:112-123) is the single source for those numbers.

Destructive and payment classes

delete and payment are consent-per-call by design (DESTRUCTIVE_CLASSES, models.rs:54): authorize_with_context skips the stored-grant lookup entirely for them (authorize.rs:50-65), so an “Always allow” never covers a delete or a payment. Payment additionally re-prompts once its cycle ends even after an explicit “always”: the grant stores the end of the current UTC month, and effective_expiry caps a legacy NULL expiry to the month the grant was created (store.rs:60-82).

For every other class a NULL expiry means never expires, not “already expired” — effective_expiry returns Unlimited (store.rs:77-79).

Pending requests and the allow-once handoff

A missing grant produces a PendingRequest in a process-wide in-memory map with a 300-second TTL (service.rs:14) and a sweeper that drops expired entries every 60 seconds. Raising and resolving are audited.

  • Allow once is a one-shot handoff, not a grant. The approval is parked in the approved_once map; the gate consumes it with take_approved_match before the grant lookup (consent_gate.rs:76-86, enforce/resolve.rs:168-185), so the model’s retry executes exactly once and the next identical request prompts again.
  • Blocking requests (the assistant waits for the answer) are resolved through their waiter instead of the parked map (enforce/resolve.rs:30-38).
  • Ownership: only the person the request belongs to may answer it, and a conversation-scoped decision must come from the conversation that asked (check_owner, enforce/resolve.rs:72-92). A refused caller changes nothing.

Cards

cards::prompt_card_html renders server-side HTML that posts to /api/consent/resolve and replaces itself with the outcome summary (cards.rs:47-92). The server card offers Allow once, Allow for this run, Allow for 1 hour, Always allow and Deny. The assistant shell renders its own card with Deny / Allow once and a VM grant bar that lists and revokes vm_all rows (assistant/modules/08_consent.js, 08c_consent_vm_bar.js).

Audit trail

consent_audit rows are written for the granted, pending, pending-destructive and denied outcomes (store.rs:22-25). The request payload keeps only hashes of the app id and arguments plus the sanitised detail view (authorize.rs:115-132); the actor is always server-derived.

HTTP surface

api.rs:98-110:

Method Path Purpose
GET /api/consent/permissions every grant of the caller, including expired rows
DELETE /api/consent/permissions/{id} revoke one owned grant
POST /api/consent/resolve answer a pending request
GET /api/consent/pending the caller’s pending requests
GET /api/ui/consent/table HTML fragment of the permission table

The typed approvals/e-signature routes from #2501 are merged into the same router and share the service state (api.rs:108-109); their routes are in the generated api-approvals and api-consent.

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move