Skip to content

ui-server: enforce admitted policy protection on authoritative agent writes #1743

Closed

Description

@schlessera

Context

Review of #1650’s draft #1741 at 1430de2bd65fb2541b30c7f86828c8916301b0e1 found a second path around a configured protect entry. With protect: [me/identity.md], the resolved worker mount refuses a direct write. The same interactive turn can call the existing curated update tool; its authoritative application route changes that document successfully.

The owned-fixture reproduction drives real runSession, makeBridge and createBrainApplication, both first-party Claude/Pi application policies, a live authorized principal and actual bubblewrap direct-write refusal. The assertion POLICY_CURATED_PROTECT_REFUSAL fails because the application returns ok: true; the fixture document actually changes. The earlier attempt failed for unrelated authority revocation and is not counted as reproduction.

validatePath in packages/ui-server/src/brain/application.ts:32–43 checks static policy/dot-path and Markdown restrictions, but no admitted governance protection list. makeBridge is created before the governed hold in packages/ui-server/src/ws/run-session.ts:435–461; the later admission at :482 supplies the worker’s frozen policy and protected mounts. The bridge’s application closure at packages/ui-server/src/ws/bridge.ts:473–495 does not receive those facts. This contradicts the policy decision’s added protected-set meaning; it is a missing enforcement path for an approved policy choice, not a request for a new permission ruling.

Scope

Make authoritative agent applications consume the actual admitted turn’s frozen effective protected paths, consistently with the worker. Cover every affected application operation and planned output, including paths generated by capture planning, submitted PNG mask destinations, and protected files/directories otherwise removed by the same mask operation's scratch cleanup. Preserve the existing static policy/alias restrictions, exact-input authority and writer-lock/revalidation behavior. Refuse a protected target with a named reason and no partial mutation.

Deliver this bounded correction together with #1650 in #1741 before the new policy surface is marked ready. It is supporting integrity work under the governed-profile programme.

Out of scope

New policy keys, new protection categories, changing tier release authority, budget/scope/egress enforcement, policy-update/revert authority, extra approval UI, or reparsing brain code on the host.

Acceptance criteria

  • The reproduced protected document remains unchanged through both adapters’ real application bindings after direct worker write refusal.
  • Existing protected files, descendants of protected directories and protected absent targets are refused for applicable create/update/remove/capture outputs; permitted documents remain writable through the same route.
  • An already admitted turn keeps its captured policy; a later policy read or a different session cannot replace that turn’s authority.
  • Validation occurs for every target under the existing write/revalidation path, including planner-derived paths, without false success or partial writes.
  • A mutation removing the policy-target guard fails the named actual application assertion, then the restored runtime and focused preflight pass. Full selected hosted proof is required before ready/merge.

Verification

The owned fixture reproduction above, both first-party policy bindings, real host application writes and worker positive/negative controls, followed by bun run check:pr --base origin/main and integrated #1741 proof after the foundation. Preserve the failing-first receipt and immutable head/base details.

Contract impact

Internal turn-to-application authority plumbing. Reuse existing refusal envelopes unless a necessary additive field is documented in the same CONTRACT commit. Existing #1650 release commitment is0.42.0.

Blocked by #1649

2026-10-12 confirmed same-class paths: both first-party mask bindings accept an authorized, matching browser PNG submission and replace a configured protected mask after the direct worker write refused. An otherwise permitted scratch mask's actual prune also removes a protected old file beneath a protected directory. These owned fixtures fail POLICY_SUBMITTED_MASK_PROTECT_REFUSAL and POLICY_MASK_CLEANUP_PROTECT_RETENTION, respectively. The bounded correction covers these exact write/removal paths with the same admitted facts; no new permission or exploratory scope is introduced.

Activity

  1. added this to the 0.42.0 milestone on Oct 12, 2026
  2. added
    type: fix
    area: ui-server
    area: backends
    on Oct 12, 2026
  3. self-assigned this
    on Oct 12, 2026
  4. added
    priority: p1
    blocked
    on Oct 12, 2026
  5. schlessera commented on Oct 12, 2026

    @schlessera
    OwnerAuthor

    Claim: policy-protect-1743-78381f66; branch feat/1650-policy-reader-78381f66, draft #1741 together with #1650. Implementing the confirmed authoritative Markdown, submitted PNG and protected scratch-cleanup paths using the turn’s captured protection, preserving existing authority, static restrictions and locks. #1649 remains the integration prerequisite; no further exploratory scope is added. Milestone 0.42.0.

  6. schlessera commented on Oct 12, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #1649 is closed, so scripts/sync-project.ts is removing the blocked label.

  7. removed
    blocked
    on Oct 12, 2026
  8. removed their assignment
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: backendsarea: ui-serverpriority: p1type: fix

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions