aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-30 13:09:47 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-30 13:09:54 +0200
commit87725dc7a2da27c2ca3b9e58af751f0e6f8c9de7 (patch)
tree4bb433e12a959d497d537c5cf3abec993795daee /packages/meshbay-hub/src
parent2c6921aa2c35ffd41b6c453e6700574ef631ba2c (diff)
downloadmeshbay-87725dc7a2da27c2ca3b9e58af751f0e6f8c9de7.tar.gz
fix: the page connects to its own origin and reCAPTCHA, nowhere else
connect-src drops https: and wss: in both policies. Checked against Google's reCAPTCHA test keys: in Chrome widget, token and registration unchanged; in Firefox the widget loads; no violation reported in either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/webapp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/webapp.py b/packages/meshbay-hub/src/meshbay_hub/api/webapp.py
index 1d3bc7e..badbdda 100644
--- a/packages/meshbay-hub/src/meshbay_hub/api/webapp.py
+++ b/packages/meshbay-hub/src/meshbay_hub/api/webapp.py
@@ -90,7 +90,13 @@ CSP = "; ".join([
f"img-src 'self' data: blob: {_RECAPTCHA_SRC}",
"media-src 'self' blob:",
"font-src 'self'",
- "connect-src 'self' https: wss:",
+ # The page talks to its own origin and nothing else — the hub, the node
+ # arrives over WebRTC, which this directive does not govern. reCAPTCHA's
+ # two origins are the only others, kept so its script may call home from
+ # this page; the register and reset views were driven in Chrome and Firefox
+ # against Google's test keys with this line and reported no violation.
+ # `https: wss:` let an injected script post anything anywhere.
+ f"connect-src 'self' {_RECAPTCHA_SRC}",
"worker-src 'self'",
# `object-src` exists for one thing, and `frame-src`'s `blob:` for the same
# thing: previewing a PDF without writing it anywhere.