Skip to content

Paths for addresses, a sandboxed frame on the same host for tier 1 script #171

Closed

Description

@allisonmahmood

Question

Where does a tier 1 patch's script run? Addresses are paths on one host, cloud.patchyhq.com/<company>/<user>/<patch> and /<company>/<patch>, so the company cookie on that host always works. If the patch's script runs directly in that page it holds the viewer's session and can call every API route as them. Options: (a) run it directly on the page, trusting colleagues' patches; (b) a sandboxed frame (sandbox="allow-scripts", no allow-same-origin) rendered by the shell at the same path, served from the same host, with the SDK reaching Patchy through the shell over postMessage; (c) a subdomain per patch with a patch-bound cookie, which was rejected during charting as over-complication.

Activity

  1. added
    wayfinder:grilling
    on Sep 6, 2026
  2. allisonmahmood commented on Sep 6, 2026

    @allisonmahmood
    OwnerAuthor

    Resolved 2026-09-06 with Allison. (b), paths outside, sandbox inside. The address and login stay exactly as the paths describe; the frame is an implementation detail of how the shell renders the content. Reason, in plain words: a colleague's tool should get access to that tool's data, not control of your whole account; if an agent produces hostile or buggy code in a patch that runs directly on the page, opening it lets that code read other company data, delete your patches or use your admin powers. Nothing short of a sandbox bounds same-origin script; HttpOnly hides a cookie's bytes, not the ability to send authenticated requests.

    What the build must get right (astra's corrections): the inner content response itself carries Content-Security-Policy: sandbox allow-scripts, otherwise opening the content URL directly runs patch code on the trusted origin; the same applies to uploaded HTML and SVG files. The broker checks event.source against the mounted frame, exposes specific SDK operations and never an arbitrary URL, and the server checks declarations and permissions per call. Session-authenticated mutations require the exact shell Origin and reject missing or null origins before execution; no state-changing GETs; WebSocket handshakes checked separately; machine-token callers have their own rule. Cookies do not reliably ride along from an opaque-origin frame, so the patch's own files reach it as broker-fetched bytes turned into frame-local blob URLs. Deep links and history are a shell-owned route bridge; downloads are a shell-owned action; printing is the one thing not promised until tested in real browsers. Consequence for the product: tier 0's "the patch cannot watch you" does not extend to tier 1; tier 1's promise is "credentials never reach patch code, and every data call goes through Patchy." The frame prototype tests the ergonomics list; if printing or deep links prove unacceptable, revisit with evidence.

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

    wayfinder:grilling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions