AIStudio2API icon indicating copy to clipboard operation
AIStudio2API copied to clipboard

[Security/Bug] Playground ChatTurn.vue binds unvalidated fileUri and grounding source.uri directly to <a :href>, allowing DOM XSS via javascript: URIs

Open photobrand opened this issue 1 week ago • 1 comments

发生了什么 / What happened

Summary

In web/src/playground/ChatTurn.vue:865-873 and 950-954, user/prompt fileUri values and grounding source.uri values are bound directly to <a :href> without URL scheme validation:

<!-- web/src/playground/ChatTurn.vue:865-873 -->
<a
  v-else-if="
    segment.part.fileData && !youtubeVideoID(segment.part.fileData.fileUri)
  "
  class="file-chip"
  :href="segment.part.fileData.fileUri"
  target="_blank"
  rel="noreferrer"
>

<!-- web/src/playground/ChatTurn.vue:950-954 -->
<li v-for="(source, sourceIndex) in sources" :key="sourceIndex">
  <a :href="source.uri" target="_blank" rel="noopener noreferrer">{{
    source.title || source.uri
  }}</a>
</li>

Trigger & Impact

Any saved/imported prompt or upstream/model grounding result containing "fileUri": "javascript:alert(document.domain)" or "uri": "javascript:..." renders a clickable link in the Web UI. Clicking it executes arbitrary JavaScript in the Web UI origin (with full access to /api/config, /api/accounts, etc.).

Suggested Fix

Validate links with a safeHref(uri) helper that only allows http: and https: URLs (returning undefined otherwise) before binding :href.

版本 / Version

v0.3.14

photobrand avatar Nov 22 '26 15:11 photobrand

每人最多同时打开 3 个 Issue,这个 Issue 已自动关闭。请等已有的 Issue 处理完再提,或把内容补充到已有的 Issue 里。

Each user can have at most 3 open issues at a time, so this one was closed automatically. Please wait until your existing issues are resolved, or add this to one of them.

github-actions[bot] avatar Nov 22 '26 15:11 github-actions[bot]