mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
<!-- Please inform yourself about the contribution guidelines on submitting a PR here: https://github.com/zitadel/zitadel/blob/main/CONTRIBUTING.md#submit-a-pull-request-pr. Take note of how PR/commit titles should be written and replace the template texts in the sections below. Don't remove any of the sections. It is important that the commit history clearly shows what is changed and why. Important: By submitting a contribution you agree to the terms from our Licensing Policy as described here: https://github.com/zitadel/zitadel/blob/main/LICENSING.md#community-contributions. --> # Which Problems Are Solved - On self-hosted ZITADEL, the CSP `img-src` directive was baked in at build time from `ZITADEL_API_URL`, blocking branding logos when the runtime domain differs from the build environment - CSP construction was duplicated across three files with no single source of truth # How the Problems Are Solved - Introduced a centralized `buildCSP()` function in `src/lib/csp.ts` that constructs the full CSP string from runtime inputs (`serviceUrl` for img-src, `iframeOrigins` for frame-ancestors) - Middleware and flow-initiation now call `buildCSP()` instead of concatenating strings against a static `DEFAULT_CSP` - `constants/csp.js` is simplified to a static fallback used only by `next.config.mjs` # Additional Changes - Removed no-op `securitySettings.embeddedIframe.allowedOrigins;` statements in flow-initiation - Removed duplicate `X-Frame-Options: SAMEORIGIN` header from `next.config.mjs` (conflicted with `X-Frame-Options: deny`) - Added `X-Frame-Options: deny` explicitly on proxy route responses in middleware (previously relied on next.config.mjs static header surviving the rewrite) # Additional Context - Closes #11088 - Closes #11602