Repository navigation
feat(plugins): contract 1.6 with hardened plugin-declared SVG icons - #251
Merged
Merged
Conversation
- Bump plugin contract from 1.5 to 1.6 (UP-068 #64577 + Tone::Accent for #60001), regenerating all 15 contract artifacts (opencode.d.luau, plugin.schema.json, api.md, generated Rust bindings). Plugins targeting 1.0-1.5 continue to load unchanged. - Add #![forbid(unsafe_code)] iterative hostile-SVG sanitizer (crates/opencode-plugin-runtime/src/svg.rs) enforcing hard caps (32 KiB, depth 16, 128 elements, 64 shapes, 16 SMIL animations, 16 KiB / 1024 path commands, 64 icons per plugin), strict tag/attribute allow-lists (rejecting <script>, <foreignObject>, <image>, <use>, <filter>, DTD/CDATA, event handlers, and external URLs), and canonical re-emission normalizing non-zero/non-square viewBox origins and root presentation attributes onto an outer <g>. - Add atomic per-plugin icon replacement (icons::replace_plugin), unload/disable icon withdrawal (icons::clear_plugin in lifecycle::stop), and <plugin>:<name> qualified cross-surface icon lookup (icons::resolve). - Route plugin IDs through every host-drawn icon field: settings rail, composer pills, titlebar items, code block actions, panel launchers, single/instance panel tabs, dormant panel launchers, narrow/mobile views, ui.segmented, and persisted closed tabs (PanelsHost::resolve_closed_icon, resolving dormant plugin icons without waking their VMs). - Migrate built-in plugins/pairing/icons/pair.svg and plugins/goal/icons/steer.svg to plugin-declared icons.
|
PR test build retired — merged into |
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…ons in dev builds (#261) - Allow Figma and common plain-geometry SVG attributes with strict value validation in crates/opencode-plugin-runtime/src/svg/{mod,validate}.rs: clip-rule and fill-rule (nonzero|evenodd only), stroke-dasharray (<= 32 finite entries, sum >= 0.5 to block tiny-dash DoS), stroke-dashoffset, paint-order, shape-rendering, vector-effect (none|non-scaling-stroke), visibility, display (none emitted; block/inline/initial dropped), color, rgb()/rgba()/inherit paints, root overflow/version/xml:space/preserveAspectRatio/percentage dims (when viewBox is present), and validated style declarations (refusing arbitrary CSS properties). - Keep all security boundaries intact: refuse <script>, <foreignObject>, <style>, <image>, <use>, <filter>, <defs>, <mask>, <clipPath>, on* handlers, href/xlink:href/src/filter/clip-path/mask/marker-*, external URLs/data URIs/url(...), arbitrary CSS, and size/depth/element/shape/path/dash limits. - Return structured error strings naming the offending element, attribute, or CSS property, and emit a dev-build stderr diagnostic (`plugin <id>: icons/<name>.svg rejected: <reason>`) in icons::replace_plugin and icons::intern_svg so rejected icons are never silent during development. - Fixes the dialog-wsl warning icon regression introduced by #251 (plugins/wsl/icons/warning.svg uses clip-rule="evenodd").
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…ing (#266) - Fold verified fleet PRs #247, #251, #252, #253, #254, #255, #256, #257, #258, #260, #261, #262, #263, #264, and #265 (Rune #1290 PRE-11 / #1296) into docs/upstream-sync/ledger.{json,md} - Audit upstream anomalyco/opencode through 92d35f8e18 (+9 commits past bf683129fa), adding UP-107..UP-113 and assigning UP-106/UP-108/UP-111 to BROWSER-UI - Update scripts/upstream-sync-check.ts to skip pure *.fixture.* test files and route browser UI/history vs extensions commits to BROWSER-UI and WS-9
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.
Ports
#64577(UP-068: GUI plugins declare their own SVG icons) and bumps the Luau plugin contract from1.5to1.6(includingTone::Accentfor#60001).Summary
crates/opencode-plugin-spec/contract.json): bumped to1.6, addedTone::Accent, updatedIconName/ComposerPillView.title/ComposerPillSpec.renderMenudocs, and regenerated all 15 bindings (cargo run -q -p opencode-plugin-spec -- --checkgreen). Plugins built for1.0–1.5load unchanged.crates/opencode-plugin-runtime/src/svg/{mod,validate}.rs,#![forbid(unsafe_code)]): iterative XML/SVG parser and canonical re-serializer enforcing hard caps (32 KiB, depth 16, 128 elements, 64 shapes, 16 SMIL animations, 16 KiB / 1,024 path commands, 64 icons per plugin), strict tag/attribute allow-lists (rejecting<script>,<foreignObject>,<image>,<use>,<filter>, DTD/CDATA,on*handlers, and external URLs), and non-zero/non-squareviewBox+ root presentation-attribute normalization onto an outer<g>. Malformed or oversized icons log a warning and fall back cleanly.icons::replace_pluginon load/reload,icons::clear_pluginonlifecycle::stop,<plugin>:<name>qualified lookup, and plugin-ID icon resolution wired through settings rail, composer pills, titlebar items, code block actions, panel launchers, single/instance panel tabs, dormant panel launchers, narrow/mobile views,ui.segmented, and persisted closed tabs (PanelsHost::resolve_closed_icon, without waking dormant plugin VMs).plugins/pairing/icons/pair.svgandplugins/goal/icons/steer.svg.Proof (
proof/ws6/pr2-icons/)huge-paths-20k(1 MB, 20k paths) 352 ms -> 45 ms;<use>billion-laughs bomb 243 ms -> 41 ms;<feGaussianBlur>/<feTurbulence>filter DoS 115 ms -> 40 ms; 2,000 nested<g>tags rejected;<script>/<foreignObject>/http:/file:rejected with 0 canary hits and fallback icon drawn.contract = "1.0","1.5", and"1.6"(including unmodified upstreamviewBox="1 1 14 14"+<animate>goal SVG) all load and draw centered in dark/light at 1x/1.5x.scripts/guardrails.ps1(5/5),cargo check --workspace, andscripts/web.ps1 -Checkgreen.