fix(csp): allow ask-trinity Cloud Function in connect-src (#1224)#1225
Merged
Conversation
The in-app Help chat widget (HelpChatWidget.vue) fetches the public docs
Q&A Cloud Function, but the prod and dev Content-Security-Policy
connect-src directives only allowed 'self' ws: wss: — so the browser
blocked every request with "Refused to connect ... violates CSP" and the
widget failed with TypeError: Failed to fetch.
Add the specific Cloud Function origin (narrow allowlist, no wildcard) to
connect-src in both CSP sources:
- src/frontend/security-headers.conf (prod nginx)
- src/frontend/vite.config.js (dev server)
ws:/wss: preserved, so WebSocket real-time delivery is unaffected.
Verified the endpoint returns permissive CORS (ACAO: *, POST/OPTIONS,
Content-Type) and answers HTTP 200 to the widget's {question} schema, so
no CORS preflight surfaces as a follow-on blocker.
Fixes #1224
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
vybe
added a commit
that referenced
this pull request
Jun 16, 2026
) (#1226) The in-app Help chat widget (HelpChatWidget.vue) fetches the public docs Q&A Cloud Function, but the prod and dev Content-Security-Policy connect-src directives only allowed 'self' ws: wss: — so the browser blocked every request with "Refused to connect ... violates CSP" and the widget failed with TypeError: Failed to fetch. Add the specific Cloud Function origin (narrow allowlist, no wildcard) to connect-src in both CSP sources: - src/frontend/security-headers.conf (prod nginx) - src/frontend/vite.config.js (dev server) ws:/wss: preserved, so WebSocket real-time delivery is unaffected. Verified the endpoint returns permissive CORS (ACAO: *, POST/OPTIONS, Content-Type) and answers HTTP 200 to the widget's {question} schema, so no CORS preflight surfaces as a follow-on blocker. Fixes #1224 Co-authored-by: Eugene Vyborov <eugene@beingluminous.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
connect-src 'self' ws: wss:omitted the docs Q&A Cloud Function origin, so the browser blocked everyfetch()withRefused to connect ... violates CSP→TypeError: Failed to fetch.https://us-central1-mcp-server-project-455215.cloudfunctions.net) toconnect-srcin both CSP sources — narrow allowlist, no wildcard, no public-surface expansion (already a documented public endpoint).Changes
src/frontend/security-headers.conf— prod nginx CSPconnect-srcsrc/frontend/vite.config.js— dev-server CSPconnect-src(mirrors prod)Test Plan
ws:/wss:still present in both files — WebSocket real-time delivery unaffectedENDPOINT(no drift)OPTIONS→204withAccess-Control-Allow-Origin: *,Access-Control-Allow-Methods: POST, OPTIONS,Access-Control-Allow-Headers: Content-Type— no follow-on CORS blockerHTTP 200to the widget's real{question}request schemaFixes #1224
🤖 Generated with Claude Code