fix(nginx): allow 'unsafe-eval' in production CSP for guest fingerprinting#496
Conversation
…nting
useGuestIdentity lazy-loads @thumbmarkjs/thumbmarkjs and calls getFingerprint()
to mint the guest identity that backs the human-verification / anti-bot gate on
the join and collect surfaces. The fingerprint probes the JS engine via eval, so
without 'unsafe-eval' in script-src the browser blocks it:
CSP: blocked a JavaScript eval ... (Missing 'unsafe-eval')
The dev-proxy CSP already carries 'unsafe-eval' (deploy/dev-proxy/nginx), so this
worked in local testing but silently broke guest fingerprinting in production —
a straight dev->prod config drift. Add it to both the server-level and the
/e/{code}/overlay CSP blocks in the production template to restore parity.
Scope/security: the directive is scoped to app.wrzdj.com via server_name; the API
(api.wrzdj.com) CSP in security_headers.py is untouched. 'unsafe-eval' weakens XSS
mitigation, accepted here to keep the fingerprint-based human gate functioning.
Deploy note: nginx is host-level — deploy.sh does NOT apply this. After merge,
re-run `APP_DOMAIN=app.wrzdj.com API_DOMAIN=api.wrzdj.com ./deploy/setup-nginx.sh`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 14 minutes and 12 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Why
On production (
app.wrzdj.com), the browser console throws on guest surfaces:useGuestIdentitylazy-loads@thumbmarkjs/thumbmarkjsand callsgetFingerprint()to mint the guest identity that backs the human-verification / anti-bot gate (join, collect, NicknameGate). The fingerprint probes the JS engine viaeval, which production CSPscript-srcblocks. The dev-proxy CSP already includes'unsafe-eval', so it worked locally but silently degraded/broke guest fingerprinting in production — a dev→prod config drift.What
Add
'unsafe-eval'toscript-srcin both CSP blocks (server-level +/e/{code}/overlay) of the production nginx template, restoring parity with the dev-proxy.app.yourdomain.comviaserver_name; the API (api.yourdomain.com) CSP insecurity_headers.pyis untouched.'unsafe-eval'weakens XSS mitigation. Accepted to keep the fingerprint-based human gate working (the same call the dev-proxy already permits). Documented inline.Not the kiosk bug: the kiosk pairing/display paths deliberately avoid
useGuestIdentity, so this is independent of thefix/kiosk-pair-cors-headereffort (no file overlap).nginx is host-level —
deploy.shdoes not apply this. After merge + deploy, re-run:Then verify the response
Content-Security-Policyheader onhttps://app.wrzdj.comcontains'unsafe-eval'.Testing
'unsafe-eval'(parity target)/api/public/guest/identifysucceedsnginx -tclean aftersetup-nginx.sh🤖 Co-authored by Claude Opus 4.8 (1M context).