You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Paths for addresses, a sandboxed frame on the same host for tier 1 script #171
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.
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.
Activity
allisonmahmood commentedon Sep 6, 2026
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 checksevent.sourceagainst 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 ornullorigins 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.