Skip to content

fix(security): harden XSS, canvas errors, and Wasm input limits - #18

Open
sousuke0422 wants to merge 5 commits into
masterfrom
fix/security-hardening
Open

fix(security): harden XSS, canvas errors, and Wasm input limits#18
sousuke0422 wants to merge 5 commits into
masterfrom
fix/security-hardening

Conversation

@sousuke0422

Copy link
Copy Markdown
Contributor

概要

リポジトリ初回監査で判明した 🚨 High(XSS×2)+クラッシュ/誤動作の Medium を修正する。生成物が v-html sink(arc-vue GanttChart.vue)へ渡るため、悪意入力・極端入力が届く経路を断つのが主眼。

CI 側の Action SHA 固定は本 PR では扱わない(PR #16 で全 workflow を一括固定)。

修正内容(各々に回帰テスト付き)

  • 🚨 XSS(属性) backend/svg.rs: escape_xml を属性安全化("" / '')+ Wasm 境界で task id を検証。data-task-id="…" から属性を抜け出す注入を防ぐ。
  • 🚨 XSS(コメント脱出) render.rs: parse error を <!-- parse error: {e} --> として返す実装を廃し、markup を返さず安全なレスポンスにする。--><img onerror=…> 等の HTML 注入を防ぐ。
  • Canvas エラー JSON 破損 render.rs: render_canvas_commands のエラー生成を文字列補間から serde_json へ。引用符/改行で JSON が壊れない。
  • Canvas 残留・未捕捉例外 arc-vueGanttChart.vue / replayCommands.ts): 失敗経路で canvas を clear・hit regions をリセット、JSON.parse を保護。前回描画・クリック領域の残留を防ぐ。
  • 入力上限(クラッシュ防止) render.rs: Wasm 入口で件数・日付範囲に実効上限を設け、超過時は安全レスポンス。極端入力での DOM/canvas 爆発を防ぐ。tiling/virtualization の全面再設計は後続。

テスト

  • cargo nextest / wasm-pack test --node 緑(悪意 id・注入入力・上限超過の回帰含む)
  • arc-vue 側テスト緑

※ DRAFT 解除・merge は maintainer 判断。後続 backlog: arc-vue CSS export / release で arc-vue publish / #11 tiling 再設計。

Assisted-by: multi-agent-shogun-aki-tweak

sousuke0422 and others added 2 commits July 14, 2026 21:42
Escape quotes in SVG attributes, return safe empty SVG on parse failure,
serialize canvas errors with serde_json, clear canvas on failure paths,
pin chromaui/action to a fixed SHA, and cap Wasm task/dep/date inputs.

Assisted-by: Cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
Assisted-by: multi-agent-shogun-aki-tweak
Action SHA-pinning across all workflows is handled by PR #16 (ci/cache-and-action-bump) to avoid touching the same file in two branches. This security branch keeps only the Rust/Vue code hardening.

Assisted-by: multi-agent-shogun-aki-tweak
@chromatic-com

chromatic-com Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 5 tests unchanged
🟢 UI Review: 5 stories published -- no changes
Storybook icon Storybook Publish: 5 stories published

Derive canvas row and date-span limits from the conservative 16384px backing-store edge, while preserving the wider SVG date limit. Reset both bitmap and CSS dimensions after empty or error output.

Assisted-by: multi-agent-shogun-aki-tweak
Assisted-by: multi-agent-shogun-aki-tweak
…lization

Assisted-by: multi-agent-shogun-aki-tweak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant