Repository navigation
fix(server): allow data and blob media fetches in CSP - #4434
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 782efda The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
sailist
approved these changes
Oct 26, 2026
This was referenced Oct 27, 2026
Closed
Merged
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 4, 2026
… as already landed MoonshotAI#4434's CSP already allows data: and blob: media fetches, MoonshotAI#4517's [workspace] require_trust section and its store short-circuit are in the tree with both locale docs, and MoonshotAI#4605's tunnel scenario already reports httpCapabilities and asserts the reconnected response. Ledger: closed 28 -> 32, remaining 67.
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.
Requirement or Bug
修复非回环 Kimi Web 页面中 data/blob 图片无法复制或另存的问题。
Bug Reproduction Steps
kimi web,使页面带上服务端 CSP。data:image/...表示的工具结果图片。fetch(data:image/...)被default-src 'self'拦截,操作失败。Root Cause
img-src 'self' data: blob:允许图片元素展示 data/blob 图片,但复制和另存需要先通过fetch()取得 Blob。CSP 未声明connect-src,因此 fetch 回退到default-src 'self',data/blob 请求被阻止。本次是对现有资源加载方式与 CSP 不匹配的根本修复,不是绕过错误提示。Code Changes
securityHeaders、securityExposure和hostExposure.e2e的 CSP 契约。connect-src仅包含'self'、data:、blob:。Behavior Changes and Affected Users
default-src 'self'限制connect-src权限127.0.0.1Web 用户验证:
securityHeaders.test.ts、securityExposure.test.ts、hostExposure.e2e.test.ts:3 个文件、17 条用例通过。pnpm --filter @moonshot-ai/kap-server run typecheck通过。MediaLightbox生产组件对照:修复前出现“复制失败”及 data fetch CSP 错误;修复后纯 data 图片和 fileId/Blob 图片均成功进入剪贴板。Checklist
gen-changesetsskill and included the approved patch changeset.gen-docsskill, or this PR needs no doc update. (No user documentation change required)Requested by qer via Mira.