[PR #410] [MERGED] Allow blob media in CSP for TTS playback #4610

Closed
opened 2026-10-22 04:09:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/410
Author: @ghost
Created: 5/4/2026
Status: ✅ Merged
Merged: 5/5/2026
Merged by: @SpicyMarinara

Base: main ← Head: fix/tts-blob-csp


📝 Commits (1)

  • f4803fc Allow blob media in CSP for TTS playback

📊 Changes

2 files changed (+2 additions, -0 deletions)

View changed files

📝 packages/server/src/middleware/security-headers.ts (+1 -0)
📝 packages/server/test/security-middleware.test.ts (+1 -0)

📄 Description

Linked issue

(https://github.com/Pasta-Devs/Marinara-Engine/issues/406)

Closes #406

Why this change

  • TTS playback regressed in 1.5.7 because the new Content Security Policy did not define media-src.
  • Browsers therefore fell back to default-src 'self' for audio playback and blocked blob: URLs created from generated TTS audio.
  • This prevented both the TTS preview button and message/game TTS playback from loading generated audio.

What changed

  • Added media-src 'self' blob: to the server Content Security Policy.
  • Added middleware test coverage to verify the CSP keeps allowing blob-backed media playback.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Ran pnpm build:shared.
  • Ran pnpm --filter @marinara-engine/server exec tsx --test test/security-middleware.test.ts.
  • Confirmed the focused middleware test passes and asserts that media-src 'self' blob: is present.
  • Manual browser/app verification still needs to be completed by a human before submission.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

N/A. Server CSP header fix; no visual UI changes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/410 **Author:** [@ghost](https://github.com/ghost) **Created:** 5/4/2026 **Status:** ✅ Merged **Merged:** 5/5/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `fix/tts-blob-csp` --- ### 📝 Commits (1) - [`f4803fc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f4803fc97c1f64e28a30c78237e8556725481fcc) Allow blob media in CSP for TTS playback ### 📊 Changes **2 files changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/middleware/security-headers.ts` (+1 -0) 📝 `packages/server/test/security-middleware.test.ts` (+1 -0) </details> ### 📄 Description ## Linked issue (https://github.com/Pasta-Devs/Marinara-Engine/issues/406) Closes #406 ## Why this change - TTS playback regressed in 1.5.7 because the new Content Security Policy did not define `media-src`. - Browsers therefore fell back to `default-src 'self'` for audio playback and blocked `blob:` URLs created from generated TTS audio. - This prevented both the TTS preview button and message/game TTS playback from loading generated audio. ## What changed - Added `media-src 'self' blob:` to the server Content Security Policy. - Added middleware test coverage to verify the CSP keeps allowing blob-backed media playback. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Ran `pnpm build:shared`. - Ran `pnpm --filter @marinara-engine/server exec tsx --test test/security-middleware.test.ts`. - Confirmed the focused middleware test passes and asserts that `media-src 'self' blob:` is present. - Manual browser/app verification still needs to be completed by a human before submission. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) N/A. Server CSP header fix; no visual UI changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:08 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4610
No description provided.