Repository navigation
fix(web): apply the content security policy to every page path - #1002
Open
Medformatik wants to merge 1 commit into
Open
Medformatik wants to merge 1 commit into
Medformatik wants to merge 1 commit into
Conversation
Medformatik
force-pushed
the
fix/csp-on-every-page
branch
from
November 16, 2026 10:00
c94931f to
7d626ff
Compare
The proxy skipped any path ending in an image or font extension and any path starting with the letters of a static prefix, so a page under such a path was served without a policy. The exclusions are now anchored to the real static locations.
Medformatik
force-pushed
the
fix/csp-on-every-page
branch
from
November 16, 2026 17:23
7d626ff to
b6e655c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
The web app sets its Content-Security-Policy in the request proxy. The proxy's matcher skipped every path that ends in an image or font extension, and its prefix exclusions were not anchored, so a path that only starts with
apioriconswas skipped too. A page under such a path, for example a shared link whose token ends in.pngor a not-found page for/x.png, was rendered without any policy.The matcher now excludes only real static locations:
_next/andapi/, the filesfavicon.icoandsw.js, and theicons/,fonts/,styles/andattribution/directories. Nothing is excluded by file extension any more, so a new page route is covered unless someone adds an exception on purpose. The stalemanifest.jsonexclusion is gone; the manifest is served as/manifest.webmanifestand was already covered.The proxy now also runs for the few image files at the root of
public/. A policy header on an image response has no effect in the browser.Related work
Seventh layer of the stack that starts with #983.
Verification
proxy.test.tspasses (24 tests). The 21 new cases check the exported matcher with Next's own matcher helper; run against the previous matcher, 8 of them fail.pnpm -C apps/web check-typesand Biome pass.Release and upgrade impact
No operator action and no migration.