Commit 944c5e4
committed
fix(favicon): resolve deployment tier at request time, not build time
Addresses review findings on PR #5588:
- Cursor (Medium): next.config.ts's rewrites() runs once during the
shared, environment-agnostic Docker build (docker/app.Dockerfile
builds with dummy env values; bootstrap.ts hydrates process.env from
AWS Secrets Manager only at container boot, after the build already
ran) - so resolving getDeploymentEnv() inside next.config.ts baked
in whichever tier happened to be active during that shared build,
never the tier the container actually runs as. Fixed by rewriting
/favicon.ico to a stable path (/api/favicon) and resolving the
destination inside that route handler instead, which runs per-request
at runtime like generateBrandedMetadata() already correctly does.
Marked force-dynamic per Next's own docs: generated icon routes are
statically cached by default unless they use a request-time API or
dynamic config.
- Greptile (P1): a whitelabeled deployment's favicon slots (16/32/192/512
PNGs, apple-touch-icon) fell back to the environment-tinted set instead
of neutral branding when brand.faviconUrl was set. Now falls back to
the production (neutral) asset set specifically for whitelabeled
deployments, matching pre-PR behavior for those slots.
- Greptile (P2, ico-serves-svg): verified via `git show origin/staging`
that /favicon.ico -> /icon.svg is pre-existing, unchanged production
behavior from before this PR - not addressed here, out of scope.
Also: added app/api/favicon/route.ts to the check:api-validation
INDIRECT_ZOD_ROUTES allowlist (no client-supplied input - only reads
the server's own deployment-tier env var) and bumped the audit baseline.1 parent 1682470 commit 944c5e4
4 files changed
Lines changed: 43 additions & 18 deletions
File tree
- apps/sim
- app/api/favicon
- ee/whitelabeling
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 29 | | |
43 | 30 | | |
44 | 31 | | |
| |||
450 | 437 | | |
451 | 438 | | |
452 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
453 | 443 | | |
454 | | - | |
| 444 | + | |
455 | 445 | | |
456 | 446 | | |
457 | 447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
0 commit comments