Public brand image fetch: the site's configured origin only, no redirect followed, a time and a byte limit

/api/ipal/admin-og resolved a relative logo address against the request's own host and fetched it with
Node's defaults (redirects followed, no timeout, no size cap); /api/ipal/admin-icon resolved the same way.
Both now resolve against serverURL / NEXT_PUBLIC_SERVER_URL (never the request) and fetch through
fetchPublicImage, which asks one address with redirect: 'manual' (a 3xx is no image), within
PUBLIC_IMAGE_TIMEOUT_MS, reading at most 512 KB. The renderer still draws PNG, JPEG, GIF (by their bytes)
and SVG (by its type, as before). Tests against local servers: hostile Host / X-Forwarded-Host, a 302 to an
internal host, an endless body, a hanging server, the normal logo. Docs say 1.17.1 instead of 1.18.0.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 22:03:52 +01:00
co-authored by Claude Fable 5.2
parent 562bf5388d
commit aef1efac73
13 changed files with 244 additions and 29 deletions
+13 -1
View File
@@ -1,4 +1,4 @@
# Changelog draft — the sign-in look (for the next minor, written as 1.18.0)
# Changelog draft — the sign-in look (for 1.17.1)
To be placed in `docs/CHANGELOG.md` by the release; the version number is the integration session's call.
@@ -16,6 +16,18 @@ Three things to look at on such a site, each with a one-line way back:
- **Editors can no longer change the site's name, logo and icon** in Site settings (admins can): these are what the
public sign-in page shows. `whiteLabel: { brandAccess: 'editor' }` gives them back.
## Security
- **The public preview-image endpoint could be made to fetch from a host named in the request.**
`GET /api/ipal/admin-og` resolved a site-relative logo address against the request's own host and fetched it with
redirects followed, no timeout and no size limit; `GET /api/ipal/admin-icon` resolved the same way. Both now
resolve against the site's configured origin only (`serverURL`, else `NEXT_PUBLIC_SERVER_URL`), ask one address,
never follow a redirect, give up after 5 s and stop reading at 512 KB. `fetchPublicImage` (exported) behaves so
for every caller and takes `{ timeoutMs }`; new export `PUBLIC_IMAGE_TIMEOUT_MS`. **For a project:** nothing to do
when `serverURL` is set (the starter sets it). A site without `serverURL` and without `NEXT_PUBLIC_SERVER_URL`
loses the logo in its panel link preview (the site name is drawn) and the icon endpoint redirects to the media
file — set `serverURL`. A logo or icon whose address answers with a redirect is no longer fetched by the server.
## Added
- **Sign-in look (`whiteLabel.signIn`, on with `whiteLabel`).** A dark panel with the label "Administration panel",