From 01d2548ab37ae03ac57c9c5df2d02d9480aa4a4d Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Mon, 12 Oct 2026 11:21:38 +0200 Subject: [PATCH] fix(14.2): WR-04 validate storage.uploads.public_path_prefix at boot The prefix was only trimmed. Without a leading slash ServeMux read its first segment as a host pattern, so every upload silently answered 404, and a CDN URL panicked in ServeMux and surfaced as a misleading route conflict. With storage.uploads.serve on, BuildRouter now refuses a prefix that is not an absolute URL path (scheme, host, query, fragment, whitespace, wildcard braces, empty, . or .. segments, or a bare /) with an error naming the key. --- docs/services/storage.md | 2 ++ modules/surf/README.md | 4 ++-- modules/surf/uploads.go | 34 +++++++++++++++++++++++++++++++--- modules/surf/uploads_test.go | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 5 deletions(-) diff --git a/docs/services/storage.md b/docs/services/storage.md index 7471ae3..d6d1686 100644 --- a/docs/services/storage.md +++ b/docs/services/storage.md @@ -57,6 +57,8 @@ The route serves originals and thumbnails and answers 404 for a missing file, an - Every response carries `Content-Security-Policy: default-src 'none'; img-src 'self'; media-src 'self'; sandbox`. A file opened as a page runs no script and gets an opaque origin, so it cannot read the application's cookies or storage. The policy does not affect an `` or `