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
+1 -1
View File
@@ -449,7 +449,7 @@ export type IaplOptions = {
* Who may change the brand the sign-in screens show (the name, logo and
* icon fields of Site settings). Default with the sign-in look: `'admin'`
* (field-level access, admins only; no schema change). `'editor'`: whoever
* may edit Site settings, as before 1.18. With `signIn: false` the default
* may edit Site settings, as before 1.17.1. With `signIn: false` the default
* is `'editor'`.
*/
brandAccess?: 'admin' | 'editor'