Skip to content

ui-server: offer once, origin and session scopes for tainted network approvals #3595

Open

Description

@schlessera

Out of scope

Changing taint sources, provider history, permanent policy, autonomous/voice permissions, ordinary egress deny/allowlist rules, byte budgets, or outward-action approvals.

Context

The tainted destination card currently has a binary decision. approveTainted in packages/ui-server/src/brain/turn-egress.ts:153-164 shares the answer per hostname; admitted in the same file adds the host to contacted hosts. contactedHosts in packages/ui-server/src/governance/session-taint.ts:45-52 restores that implicit session grant from charged connection records. Both approval surfaces render in packages/ui-react/src/components/chat/tool-permission-card.tsx and packages/ui-react/src/components/activity/approval-card.tsx.

Decision (maintainer, 2026-11-05)

The maintainer requested and authorized implementing four choices: Allow once, Allow this origin for this session, Allow all origins for this session, and Deny. This adds explicit scopes to the taint-network card, superseding the single hostname-wide choice from #3430 for clients selecting a scope. A missing scope retains legacy hostname/session behavior for old clients. No permanent policy write is implied.

Scope

Add host-advertised network origin metadata and an explicit once/origin/session approval reply. Persist session grants in host-owned governance records, scoped to the exact chat session, across turns and reconnects. One-time connections never create a contacted-host exemption. Origin identity distinguishes cleartext HTTP from an opaque CONNECT tunnel and includes the effective port; do not claim visibility into a CONNECT payload. Both approval surfaces show the four authorized labels and truthful receipts. Keyboard allow remains the narrowest choice. Wider grants only bypass taint-specific network questions.

Acceptance criteria

  • Once permits one connection and asks again, including later turns; concurrent one-time connections do not share one grant.
  • Origin/session grants survive later turns, remain in the same session, and distinguish ports and HTTP versus CONNECT.
  • Denial, cancellation, missing authorization, and failed durable recording grant no access. Late answers to cancelled cards cannot create a grant.
  • Deny/allowlist/byte limits and separate outward approvals still apply, including after a session grant. Voice and autonomous permissions do not widen.
  • Both card surfaces, keyboard shortcuts, reconnect recovery and receipts preserve the selected scope. Unadvertised scopes cannot create grants.
  • Legacy replies without a scope retain the prior host/session behavior. Unrelated approvals retain existing behavior.
  • Contract and decision docs, API reports and a minor changeset describe the additive fields and behavior.

Verification

Keyless real loopback proxy tests with a permission-bridge double; host dispatch/schema checks; component tests for decisions and receipts; real browser coverage at narrow/desktop widths. Retain failing-first and restored-mutation evidence for scope boundaries. Run contribution preflight.

Contract impact

Additive optional approval request/reply fields, governance grant records and scoped-connection metadata. Old clients keep their existing default. Minor release, CONTRACT commit prefix and integration-contract update required.

Activity

  1. added
    type: feat
    area: ui-server
    area: ui-react
    agent-ready
    contract
    on Nov 5, 2026
  2. self-assigned this
    on Nov 5, 2026
  3. schlessera commented on Nov 5, 2026

    @schlessera
    OwnerAuthor

    Implemented locally on the approval-options branch; no PR or merge yet.

    The explicit scopes are additive. Missing scope preserves legacy hostname/session behavior. HTTP and opaque CONNECT origins are distinct, including effective ports. Wider grants commit before admission; once admissions are excluded from contacted-host reconstruction. Both card surfaces carry the four requested labels, and keyboard allow remains once. Per-turn serialization lets a broader decision cover queued connections without turning once into a shared grant.

    The browser dispatch source audit also required refreshing its reviewed chat handler digest: the only handler change forwards the host networkOrigin field into the approval store. Existing ownership, escape, source-drift and terminal-handler rejection tests remain intact and pass.

    Validation:

    • Failing first: bun run test packages/ui-server/tests/tainted-destination-ask.test.ts -t 'explicit once never' failed at TAINTED_ASK_CARD_RAISED (expected asked, received settled), proving the prior implicit hostname grant. The earlier missing-workspace-dependency failure is not counted as behavioral proof.
    • Mutation: removing the scoped-connection exclusion from contactedHosts makes the same named test fail on that expected assertion in the later turn; restoring it passes.
    • Focused network/governance/host/schema/card suite: 90 passed. Final scoped-proxy/card rerun after adding a distinct-host boundary: 31 passed.
    • Permission gate, proxy and both installed-backend keyless provider-history guards: 76 passed.
    • Pinned browser node scripts/visual.mjs --project=ui-react-layout --filter=tool-permission.layout: 12 passed, covering 320px/desktop, both approval surfaces, redelivery, target sizing and the emitted session scope. The initial unbuilt-workspace import failure and corrected test-fixture selector error are retained as failed runs, not claimed as proof.
    • NODE_OPTIONS=--max-old-space-size=12288 bun run typecheck: passed. The default 4-GiB Node heap exhausted memory; the source check passed with the larger heap.
    • bun run check:pr --base origin/main: passed all gates and 1,257 affected fast tests. Its initial two dispatch-audit failures were resolved by the reviewed digest refresh above.
    • Package build, API reports, pending changeset package validation and complete pending Changesets plan passed. API changes are optional additions and the changeset is minor.

    No hosted candidate proof or merge is claimed. The local preflight receipt remains available with the working changes for a future PR.

  4. added this to the 0.45.0 milestone on Nov 9, 2026
  5. added
    priority: p1
    on Nov 9, 2026
  6. schlessera commented on Nov 9, 2026

    @schlessera
    OwnerAuthor

    2026-11-09 triage: added the missing priority: p1. The issue never had a priority label. It carries the 0.45.0 milestone, sits under p1 epic #3428, and the maintainer requested and authorized implementing it on 2026-11-05, so it is a current-milestone commitment. No other label, body, assignment or milestone change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-reactarea: ui-servercontractpriority: p1type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions