feat(desktop): allow relay-backup.superset.sh in renderer CSP#4473
Conversation
Adds a stable additional host to the renderer connect-src so the relay-url-override PostHog flag can route the desktop at a non-prod relay (staging, failover, etc.) without cutting a new desktop build each time the override target changes. %RELAY_URL% remains the primary baked-in entry; relay-backup.superset.sh is a CNAME we can repoint via DNS or PostHog payload alone.
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR updates the desktop renderer's Content Security Policy to authorize outbound connections to a backup relay endpoint. The ChangesBackup Relay Connectivity
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds
Confidence Score: 5/5Single-line CSP addition to a controlled superset.sh subdomain; no logic, no runtime code, no new dependencies. The change is a one-token addition to a meta tag — adding one explicit HTTPS origin to No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/index.html | Adds https://relay-backup.superset.sh to the connect-src CSP directive alongside the existing build-time %RELAY_URL% placeholder; comment updated to document the rationale. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Desktop Renderer] -->|connect-src check| B{CSP allows host?}
B -->|self / 127.0.0.1 / posthog / sentry| C[Allowed ✓]
B -->|%RELAY_URL% → relay.superset.sh HTTPS| C
B -->|relay-backup.superset.sh HTTPS — NEW| C
B -->|ws: or wss: — any host WebSocket| C
B -->|other origin| D[Blocked ✗]
C --> E[Request proceeds]
D --> F[CSP violation in DevTools]
Reviews (1): Last reviewed commit: "feat(desktop): allow relay-backup.supers..." | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
https://relay-backup.superset.shas a pre-allowedconnect-srcentry in the desktop renderer's CSP, alongside the existing%RELAY_URL%(which is replaced withhttps://relay.superset.shat build time).relay-url-overridePostHog flag payload, so we can route a user's host-service / desktop renderer at a non-prod relay (staging, failover) without cutting a new desktop release each time the override target changes.%RELAY_URL%substituted at build time, so any override URL gets blocked byconnect-srcfor HTTPS requests (thewss:scheme-only entry already lets WS through, which is why CLI tunneling works against any host).Test plan
index.htmlcontainshttps://relay-backup.superset.shin theconnect-srcdirective.relay-url-overrideflag set to{"url": "https://relay-backup.superset.sh"}for a test user, the desktop renderer can issue HTTPS trpc requests to the relay (workspace creates, port queries) without CSP violations in DevTools console.relay.superset.sh.Notes
relay-backup.superset.shresolves via CNAME to the staging Fly app today; we can re-CNAME it elsewhere (failover, new staging env) without redeploying desktop.Summary by cubic
Adds https://relay-backup.superset.sh to the desktop renderer CSP (
connect-src) so therelay-url-overrideflag can route HTTPS requests to a staging/failover relay without shipping a new desktop build.%RELAY_URL%remains the primary host; behavior is unchanged for users not in the flag cohort.Written for commit f55aea8. Summary will update on new commits.
Summary by CodeRabbit