Script dedup key truncation may cause collisions

オープン 初心者向け
#37 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
frontend

調査の方向性

apps/app/src/components/generative-ui/widget-renderer.tsx の369-370行目から始めます。ここでは、実行済みのスクリプトが切り詰められたbase64キーで追跡されています。周辺のiframe-bridgeロジックを確認し、異なるスクリプト内容に異なるdata attributesが付与されることを検証してください。衝突のリスクがなくなり、すでに実行されたスクリプトが再度実行されなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

Problem

In the widget renderer's iframe bridge (widget-renderer.tsx:369-370), executed scripts are tracked using a truncated base64 key:

```js
content.getAttribute('data-exec-' + btoa(key).slice(0, 16))
```

Truncating to 16 characters creates a collision risk for scripts with similar prefixes. Two different scripts could hash to the same 16-char prefix, causing the second script to be skipped.

Impact

Low probability with current usage (small widget scripts), but could cause bugs if:

  • Widgets include multiple scripts with similar content prefixes
  • Templates are applied with untrusted or user-influenced content

Suggested fix

Use the full btoa(key) value instead of truncating, or switch to a proper hash function. The data attribute name length is not meaningfully constrained.

Files

  • apps/app/src/components/generative-ui/widget-renderer.tsx

From PR #20 review

主要言語
TypeScript
スター
1.6k
フォーク
202
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CopilotKit/OpenGenerativeUI のほかの issue

CopilotKit/OpenGenerativeUI の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。