Skip to content

fix: allow GitHub-hosted episode audio through CSP media-src#90

Merged
Samurai33 merged 2 commits into
mainfrom
fix/csp-media-src-audio
Jul 12, 2026
Merged

fix: allow GitHub-hosted episode audio through CSP media-src#90
Samurai33 merged 2 commits into
mainfrom
fix/csp-media-src-audio

Conversation

@Samurai33

Copy link
Copy Markdown
Owner

Summary

Episode audio stopped working in production after the CSP added earlier this session (headers()) - audio.src in contexts/AudioContext.tsx points at github.com/.../releases/download/... (redirecting to release-assets.githubusercontent.com), but the CSP had no media-src directive, so browsers fell back to default-src 'self' and silently blocked it (CSP violation, not a network error - the player just spun forever).

Fix: added media-src 'self' https://github.com https://*.githubusercontent.com to the CSP in next.config.mjs.

Test plan

  • Confirmed all 3 GitHub Release audio URLs resolve correctly (200, correct Content-Length) - ruled out a hosting issue
  • Reproduced the bug locally: next start with the old CSP, clicking play never reached "playing" state
  • Verified the fix: after adding media-src, curl -I shows the header updated, and clicking play in the browser flips to "Reproduzindo..." with zero console errors
  • lint + type-check + test (27/27) + build all clean

… domain

Connected cyberjus.org to the Vercel project today (A record @ -> 216.198.79.1,
CNAME www -> Vercel's assigned target, both DNS-only on Cloudflare to avoid
double-proxying the TLS handshake). Update the code-level fallback so
metadataBase/OpenGraph/robots.txt/sitemap.xml resolve to the real domain
without needing NEXT_PUBLIC_SITE_URL set as an env var.
Episode audio broke in production after the CSP added in the earlier
security-headers pass: audio.src (contexts/AudioContext.tsx) points at
github.com/.../releases/download/... and its release-assets.githubusercontent.com
redirect target, but the CSP had no media-src directive, so it fell back to
default-src 'self' and silently blocked every episode's audio in the browser
- no network error, just a CSP violation and a stuck "loading" spinner.

Verified locally: before the fix, `next start` + actually clicking play left
the UI unresponsive; after adding media-src, clicking play flips the button to
"Reproduzindo..." with zero console errors.
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-cyber-justica Ready Ready Preview, Comment, Open in v0 Jul 12, 2026 2:37pm

@Samurai33
Samurai33 merged commit 854889c into main Jul 12, 2026
3 checks passed
@Samurai33
Samurai33 deleted the fix/csp-media-src-audio branch July 12, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant