fix: allow http://localhost in dev-build CSP#19
Merged
Conversation
PR #18 added a tight `connect-src 'self' https://us.i.posthog.com https://*` to extension_pages CSP. Chromium MV3 applies this to the background service worker, blocking every wallet→chain fetch against http (incl. localhost). Local-dev / recording / pairing flows hit http://localhost:8000/soroban/rpc, so the wallet's add-channel auth() read fails with `SIM_002` and downstream deposit/send/withdraw inherit the same Failed-to-fetch. Widen connect-src with `http://localhost:*` only when DEV=1. Production builds (build-prod / release.yml) ship the manifest unchanged, so the CWS / AMO artifact stays restricted to https.
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
PR #18 added
connect-src 'self' https://us.i.posthog.com https://*to the extension_pages CSP. Chromium MV3 applies that to the background service worker too, so every wallet→chain fetch over plain http (incl. localhost) is now blocked. The recording-rig + local-dev pairing flows hithttp://localhost:8000/soroban/rpc, which means the wallet's add-private-channelauth()read fails withColibriError SIM_002: The transaction could not be simulated!, and downstream deposit / send / withdraw / receive inherit the sameTypeError: Failed to fetch.This widens
connect-srcwithhttp://localhost:*only when DEV=1, so:deno task build(dev): manifest CSP includeshttp://localhost:*→ SW can talk to local-dev's Soroban RPC.deno task build-prod(release.yml): manifest is copied unchanged → CWS / AMO artifact keeps the tight https-only CSP.Repro / verification
From the wallet's service worker against this branch's dev build:
Production build (
deno task build-prod) emits the manifest verbatim — diff againstmanifest.jsonis zero.Test plan
deno fmt --check— cleandeno lint— cleandeno task build— manifest CSP gainshttp://localhost:*deno task build-prod— manifest CSP unchanged from sourcehttp://localhost:8000unblocked on dev, https fetches unchangedprivate-transferfrom the recording rig clears the create-channel step (will re-run on the local-dev branch once this merges)