Repository navigation
fix(console): send browser hardening headers on the operator console - #650
Merged
Merged
Conversation
Add X-Content-Type-Options: nosniff, X-Frame-Options: DENY, and Referrer-Policy: no-referrer to console HTML, the SPA fallback, and embedded assets. The public OpenAI/Anthropic gateway endpoints keep their protocol-only response surface.
caigee-cmd
approved these changes
Dec 4, 2026
caigee-cmd
left a comment
Owner
There was a problem hiding this comment.
已审:控制台加固头只加在 /assets/、favicon、manifest 和 SPA 回退的 HTML 响应上,/v1/* 网关端点不受影响(本地逐路径验证过)。新增测试覆盖 /、/login、/assets/。CI 全绿。可以合;PR 只落后 main 一个提交(#649,store 改动),无冲突。
小建议(不阻塞):未知路径的 404(http.NotFound)和 /api/* 控制台接口没有这几个头,可以后续再补。
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.
Problem
The authenticated operator console and its embedded SPA assets were served without basic browser hardening headers. Because the console and the public gateway share one mux, the headers must be scoped to the console only.
Change
setUISecurityHeadersaddsX-Content-Type-Options: nosniff,X-Frame-Options: DENY, andReferrer-Policy: no-referrer.withUISecurityHeaderswraps the embeddedwebui.Handler()used for/assets/, the favicons, the manifest, and the SPA fallback./v1/*endpoints are untouched and keep their protocol-only response surface.Validation
go vet ./internal/server/...go test ./internal/server/... -run TestConsoleUISendsSecurityHeaders -vgit diff --check