Repository navigation
feat(agents): isolate html visuals on web and desktop - #718
Merged
Merged
Conversation
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
from
November 14, 2026 13:10
ea6362b to
3fc9d2d
Compare
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
from
November 14, 2026 13:17
3fc9d2d to
fd7259b
Compare
This was referenced Nov 14, 2026
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
from
November 14, 2026 14:18
fd7259b to
14380f3
Compare
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
2 times, most recently
from
November 14, 2026 14:53
cca9e4e to
df2082b
Compare
nixuuu
marked this pull request as ready for review
November 14, 2026 14:55
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
from
November 14, 2026 15:03
df2082b to
e0bc558
Compare
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
from
November 14, 2026 15:15
e0bc558 to
c08a5ca
Compare
nixuuu
force-pushed
the
feat/agents-html-renderers
branch
from
November 14, 2026 15:32
c08a5ca to
46d7c9e
Compare
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Adds `render_html` beside `render_visual`, storing HTML as an immutable, owner-scoped visual version. The existing item, GetVisual, expected_version, citation and export pipeline remains the source of truth. Old clients reject kit version 2; workers and gateways negotiate `thread_html_v1` additively. The shared compiler rebuilds untrusted HTML, attempts to remove embedded documents, navigation attributes, inline handlers and external/module scripts, and prefixes each classic script with lockdown before hashing it. Removal is best-effort: parser differences and reparsing can restore markup (mXSS); CSP is the execution/resource boundary. Foreign MathML/SVG style elements are additionally discarded. Script CSP is hash-only; there is no unsafe-eval or unsafe-hashes. The trusted shell also restricts child navigation. Web/mobile residual network risk is explicitly accepted: matching-SRI external scripts and DNS hints can still send data. Desktop adds a separate network-denied browser process in #718. Validation: install, generation, typecheck, lint and formatting passed. The focused compiler/inbox/migration/gateway/harness run passed 58 tests. Tests cover pre-parse/UTF-8 limits, CSP hashes, stripped permissive metas, script-only sandbox, cyclic/invalid/flooded messages, owner scoping, version conflicts and format preservation. Migration is now **0144_thread_html** (file, index and schema expectation), following dev's 0143 from #725. The CLIProxyAPI stack moves to 0145; this stack merges first. Protocol remains additive. Security review fixes: the CSP meta, style and bootstrap scripts are inserted as parse5 tree nodes. Regression tests cover `<html data-x="<head>">`, a leading `<!-- <head> -->`, and `</body>` text in attributes/comments: exactly one CSP meta is first in the real head and every executable script has an authorized hash. Gateway publishing applies the same depth100/script64 limits as clients; rejected documents leave no stored version. The shell relay forwards only `JSON.parse(text).message`; an 8 MiB ArrayBuffer regression proves the original clone is not forwarded. Shared iframe permissions explicitly deny PiP and clipboard features. The focused security/gateway/three-harness run passed 38/38; channel identity tests passed 3/3. Per-platform probe evidence is recorded on #718, including the DNS positive control and protected result. The independent security re-check recommended merge. Copy audit: no new UI copy in this layer; tool instructions state inline-only code, addEventListener, size/script/depth limits, theme variables and no secrets. Previous-head full check:tmp was green in [CI run 43605016001](https://github.com/itsoltech/canopy/actions/runs/43605016001), head `cc18c0b7d86ae78ddd7d1cdff1af221107910367`. Pre-merge update: rebased onto origin/dev including #723, #725 and #730, preserving the new visual kit/gallery compiler and provider migration. The shell's own hash-authorized script now starts with the shared network lockdown, including when copied into a fresh realm. Only the trusted mobile shell retains its own message bridge; opaque agent realms have none and also remove ReactNativeWebView. Regression tests exercise web/native relay, locked RTC/fetch properties, the shell hash prefix and MathML/SVG reparsing with script-src-attr none. Final-head checks: schema/compiler 51/51, visuals/three-harness integration 16/16, both with empty temp directories; gen:check, full typecheck, lint and format:check passed. Immediately before the final push, origin/dev was re-fetched at d2af937 and its highest migration confirmed as 0143. New-head full CI is pending. All four PRs are ready, as requested; no merge performed.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Offers `render_html` through the shared tool catalog on Claude Agent SDK, Codex app-server and Grok ACP. The worker announces `thread_html_v1`; an older gateway gets an actionable update response instead of an unknown-tool call. Validation: fake adapters for all three harnesses publish HTML through WorkerLink into PostgreSQL. Existing component-tool coverage is retained. The focused compiler/inbox/migration/gateway/harness run passed 58 tests; install, generation, typecheck, lint and formatting passed. Security/gateway/three-harness run passed 38/38, including fake adapters publishing through WorkerLink. Platform probes are recorded on #718. Gateway depth100/script64 errors reach the tool before storage. The independent security re-check recommended merge. Copy audit: model-facing description prefers components for standard charts/cards/tables, requires addEventListener rather than inline handlers/eval, inline libraries/assets, no network or secrets, bounded documents and Canopy theme variables. No UI copy changes in this layer. Previous-head full check:tmp was green in [CI run 43605016001](https://github.com/itsoltech/canopy/actions/runs/43605016001), head `cc18c0b7d86ae78ddd7d1cdff1af221107910367`. Pre-merge update: rebased onto origin/dev including #723, #725 and #730, with render_html migration 0144 after the provider migration 0143. The shared compiler/shell P3 fixes and regression evidence are described in #716 and #718. Final-head schema/compiler tests: 51/51; gateway/three-harness visuals integration: 16/16; both temp checks clean. Generation, typecheck, lint and formatting passed. New-head full CI is pending. All four PRs are ready; no merge performed.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
HTML visuals now start as an inert warning card with an explicit **Run** action. No HTML compilation or WebView mount occurs before Run. Watchdog failure requires explicit Retry; revisiting/remounting starts inert again. The existing WebView shell and per-mount token envelope use the same hash-only CSP, lockdown and explicit denied-feature permissions as web. Existing fullscreen, version picker, citations and save/share HTML use the shared visual pipeline. No native modules, native patches or WebView upgrade. Baseline/current fingerprints match exactly: iOS `138e0c6b171c82b4933e86808cdfef56da73b8c6`, Android `906dc944f94eb8333fa384ed9f198834fdd30d13`. Both platform exports passed. ### Platform evidence and accepted gaps | Platform | Evidence | |---|---| | Web | Chromium 155 hostile-document probes on the renderer PR: opaque isolation, hash/eval restrictions, denied known networking APIs, nested realm tests and responsive host under an infinite loop. Matching-SRI external-script request remains an accepted exfil path. | | Desktop | Electron 45.2.1 separate browser process with resolver denial: runtime dns-prefetch/preconnect produce no canary resolver events; image/fetch/RTC/matching-SRI attempts produce no canary HTTP requests; canvas PiP throws SecurityError. Production sidecar loop recovery and >2MB compiled-document probes passed. Measurement details and limitations are on #718. | | iOS / Android | **Device probes not run.** device_open failed with “Device list failed: Could not communicate with device support. Try refreshing devices.” One refresh returned the same error. JS exports and shared shell tests do not substitute for WKWebView/Android WebView runtime probes. | As explicitly agreed, mobile accepts the browser residual network risk. RN WebView 14.0.1 exposes neither Android subresource interception nor iOS WKContentRuleList. File/universal access off, incognito, blocked navigation, no shared cookies/storage/windows and the token envelope are retained. iOS mediaCapturePermissionGrantType denies capture. On Android the library can auto-grant camera/microphone permissions already granted by the OS; lockdown mediaDevices and the opaque iframe permissions boundary are the available defenses without a native change. A hard network block and complete native permission denial require a later native build. These gaps are documented in Polish in docs/agent-visuals.md. Focused security/gateway/three-harness checks passed 38/38. iOS/Android exports passed after review fixes; fingerprints above remain unchanged. Validation is recorded on #718. The independent security re-check recommended merge. Native hostile-document probes and native light/dark/phone-width acceptance remain unverified. No hard renderer memory quota is claimed. Same-process WebViews can freeze the app after Run, preventing the watchdog from firing; click-to-run prevents automatic re-entry on later visits. DNS hints, matching-SRI exfiltration, pastejacking and exported-file execution remain documented browser/mobile risks. Copy audit (§8): **Run** explicitly starts execution. “Custom HTML from the agent. Don't enter passwords or secrets.” gives source plus a direct instruction, plain English, no jargon or humor. “This visual stopped responding.” reuses the existing Retry action. Theme-aware text colors and app-owned framing preserve meaning without depending on color. Device layout/accessibility review remains blocked, not claimed as passed. Previous-head full check:tmp was green in [CI run 43605016001](https://github.com/itsoltech/canopy/actions/runs/43605016001), head `cc18c0b7d86ae78ddd7d1cdff1af221107910367`. Pre-merge update: rebased onto origin/dev including #723, #725 and #730, with render_html migration 0144 after the provider migration 0143. The shell executable now starts with shared network lockdown while retaining its trusted native message bridge; the native/web relay regression passes in both modes. Markup stripping is best-effort and CSP remains the boundary against mXSS; foreign MathML/SVG style nodes are discarded. No native change. Final-head schema/compiler tests: 51/51; gateway/three-harness visuals integration: 16/16, both temp checks clean. Generation, full typecheck, lint and formatting passed. New-head full CI is pending. All four PRs are ready; no merge performed.
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HTML visuals run inside an opaque
sandbox="allow-scripts"iframe, with hash-only scripts prefixed by lockdown. The card identifies agent content and warns against entering passwords or secrets. Web and mobile require an explicit Run; desktop requires opening a separate viewer. The main window CSP is unchanged.Independent security review fixes
<head>inside an HTML attribute and a leading comment, and misleading</body>text. Exactly one CSP meta is first in the actual head; every executable script is hashed. Downloads include CSP and lockdown.Desktop DNS boundary
The DNS finding reproduced: runtime
dns-prefetchescaped CSP, proxy and webRequest. A renderer additionalArguments Blink flag did not reliably reach the renderer and did not stop it. The viewer therefore runs in a separate Electron browser process, configured before ready withhost-resolver-rules=MAP * ~NOTFOUND. The network boundary is the resolver rules plus the refusing proxy plus webRequest cancellation. The unsupporteddisable-network-predictionswitch has been removed. This applies to every viewer frame without changing the main app's flags, session or CSP. The independent security re-check verified the resolver block and judged it sufficient.The child retains a dedicated ephemeral session with deny proxy, request cancellation, denied permissions/devices/downloads/navigation/popups and
disable_non_proxied_udp. It receives only bounded source, title and theme through private process IPC and a curated OS/display environment. It has no app services, app profile or credentials. One viewer is allowed; parent exit closes it and its temporary profile is removed.Review-fix probes
Electron 45.2.1, Linux, headless Ozone; actual viewer/compiler implementation:
DNS_CANARY_EVENTS [].HTTP_CANARY_REQUESTS []; image CSP violation; fetch/RTC undefined and calls throw TypeError.Custom HTML from the agent — Canopy.This visual stopped responding.DNS evidence uses Chromium netlog with a positive control, not packet capture: tcpdump was unavailable and privileged capture was not available. It demonstrates no canary resolver events in the protected run; it is not a claim of observing port 53. The direct diagnostic harness used
--no-sandbox; the actual production sidecar startup/large-document/loop probes ran without that flag in the child.Earlier compiler/shell probes retained
Chromium 155.0.8059.84 against the actual compiler/shell:
Web/mobile also retain DNS-hint, pastejacking, file-export and same-process engine risks, documented in Polish in docs/agent-visuals.md §9. Source, cache and live-frame counts are bounded; no hard browser renderer memory quota is claimed. Exported HTML includes CSP/lockdown but executes JS outside the Canopy iframe sandbox when opened as a file.
Validation
Install, gen:check, full typecheck (Svelte: zero errors/warnings), lint, format:check, focused security/gateway/three-harness tests (38/38), channel identity tests (3/3), web build and iOS/Android exports passed. Fingerprints remain iOS
138e0c6b171c82b4933e86808cdfef56da73b8c6, Android906dc944f94eb8333fa384ed9f198834fdd30d13.Previous-head full check:tmp was green in CI run 43605016001 on
cc18c0b7d86ae78ddd7d1cdff1af221107910367: all four check:tmp shards passed, and the final job verified that every test file actually ran exactly once. Static checks and web/Linux build were green too. The redundant local full run was interrupted after this complete CI result; it is not claimed as a local full-suite success.Actual VisualFrame fixture reviewed in Chromium at 1280px/390px, light/dark: no iframe before Run; counter increments after Run; warning wraps within the card. A button-triggered infinite loop shows the stopped warning; resizing does not remount, and remounting the component shows Run with no iframe. Screenshots were inspected. The fixture is isolated from a gateway; this does not certify an authenticated timeline, long-title header, or version-picker flow. Native iOS/Android hostile-document probes remain unverified; mobile exports do not establish native runtime behavior. The independent security re-check recommended merge.
Pre-merge update: rebased onto origin/dev including #723, #725 and #730, with render_html migration 0144 after the provider migration 0143. The shell's hash-authorized executable now begins with network lockdown, preventing its inherited hash from authorizing an unlocked fresh realm. Markup removal is best-effort: MathML/SVG and browser reparsing can recreate removed elements/attributes (mXSS), so CSP, not sanitization completeness, is the boundary. Foreign-content style nodes are additionally stripped. Regression tests check the retained restrictive policy, absence of reparsed handlers, shell prefix/hash, immutable RTC/fetch removal in a fresh VM realm and preserved trusted native relay. Final-head schema/compiler: 51/51; gateway/three-harness visuals integration: 16/16, both temp checks clean. Generation, full typecheck, lint and formatting passed. The pinned Electron binary contains the host-resolver-rules switch token, with no disable-network-prediction token found. New-head full CI is pending. All four PRs are ready; no merge performed.
Copy audit (§8): Run is the explicit action that starts agent JS. “Custom HTML from the agent. Don't enter passwords or secrets.” identifies the source and gives one concrete instruction. “This visual stopped responding.” names the failure and retains an explicit Retry. Desktop's action describes opening a separate window. No jargon, humor or color-only meaning in these strings.