Repository navigation
fix(plugins): broaden SVG plain-geometry boundary and log rejected icons in dev builds - #261
Merged
Merged
Conversation
…ons in dev builds
- 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").
|
PR test build retired — merged into |
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.
Fixes the
dialog-wslwarning icon regression caught by REFERENCE after#251(51986c66), whereplugins/wsl/icons/warning.svgwas rejected becauseclip-rule="evenodd"was missing fromPRESENTATION_ATTRS.Boundary Audit (
crates/opencode-plugin-runtime/src/svg/{mod,validate}.rs)fill-rule/clip-rule:"nonzero" | "evenodd"only.stroke-dasharray:"none"or1..=32finite lengths in[0, 1024]with sum>= 0.5(blocks tiny-dashtiny-skiastroking DoS);stroke-dashoffset:[-1024, 1024].stroke-linecap(butt|round|square),stroke-linejoin(miter|round|bevel),stroke-miterlimit([1, 100]),stroke-width([0, 256]),opacity/fill-opacity/stroke-opacity([0, 1]).paint-order(normalor distinctfill/stroke/markers),shape-rendering,vector-effect(none|non-scaling-stroke),visibility,display(noneemitted;block|inline|initialdropped),fill/stroke/color(none,currentColor,inherit,transparent,black,white,#hex, canonicalizedrgb()/rgba()).xmlns="http://www.w3.org/2000/svg",xmlns:xlink="http://www.w3.org/1999/xlink",version,xml:space,overflow,preserveAspectRatio,image-rendering,text-rendering,x/y, percentagewidth/height(whenviewBoxis present),pathLength, and safestyledeclarations (only validated presentation attrs +color: var(--<ident>); arbitrary CSS properties are now refused).<script>,<foreignObject>,<style>,<image>,<use>,<filter>,<defs>,<mask>,<clipPath>,on*,href,xlink:href,src,filter,clip-path,mask,marker-*,url(...),http(s):,data:,file:,javascript:,expression(,@import, arbitrary CSS instyle, tiny-dash DoS, and all size/depth/element/shape/path caps.icons.rs,svg/{mod,validate}.rs):Result<SanitizedIcon, String>naming the exact offending element, attribute, or CSS property.icons::replace_plugin/icons::intern_svgemit oneeprintln!line indebug_assertionsbuilds (plugin <id>: icons/<name>.svg rejected: <reason>) in addition to the plugin console warning.Proof (
proof/ws6/svg-boundary-fix/)plugins/goal/icons/active.svgplugins/goal/icons/complete.svgplugins/goal/icons/paused.svgplugins/pairing/icons/dialog-close.svgplugins/pairing/icons/pair.svgplugins/wsl/icons/chevron.svgplugins/wsl/icons/download.svgplugins/wsl/icons/warning.svg(clip-rule="evenodd")browser/assets/{viewport-device-chevron,viewport-rotate}.svg(overflow="visible",style="display: block;")dialog-wslvsproof/reference/captures/local/warning icon box:[620..660, 320..360]):0diff px (>2),maxDelta = 0, filled triangle520/520px.[620..660, 320..360]):0diff px (>2),maxDelta = 1, filled triangle520/520px.[930..990, 480..540]):0diff px (>2),maxDelta = 1, filled triangle1200/1200px.[930..990, 480..540]):0diff px (>2),maxDelta = 0, filled triangle1200/1200px.use-bomb,filter-dos,huge-paths-20k,deep-2000,script-tag,foreign-obj,external-href,clip-path-attr,mask-attr,bad-clip-rule,bad-fill-rule,bad-style-css,tiny-dash-dos,zero-vb,malformed.scripts/guardrails.ps1(5/5),cargo check --workspace, andscripts/web.ps1 -Checkgreen.