Repository navigation
fix(@angular/ssr): validate host headers to prevent header-based SSRF [main] - #32499
Closed
alan-agius4 wants to merge 2 commits into
Closed
alan-agius4 wants to merge 2 commits into
alan-agius4 wants to merge 2 commits into
Conversation
alan-agius4
force-pushed
the
security-issue
branch
3 times, most recently
from
February 17, 2026 09:04
07d009a to
26e57a6
Compare
alan-agius4
force-pushed
the
security-issue
branch
from
February 17, 2026 09:19
26e57a6 to
40f0c57
Compare
This change introduces strict validation for
Host,X-Forwarded-Host,X-Forwarded-Proto, andX-Forwarded-Portheaders in the Angular SSR request handling pipeline, includingCommonEngineandAngularAppEngine.Previously, the application engine constructed the base URL for server-side rendering using these headers without validation. This could allow an attacker to manipulate the headers to steer relative
HttpClientrequests to arbitrary internal or external hosts (SSRF).With this change:
HostandX-Forwarded-Hostheaders are validated against a strict allowlist.localhostand loopback addresses (e.g.,127.0.0.1,[::1]) are allowed by default.X-Forwarded-Portmust be numeric.X-Forwarded-Protomust behttporhttps.400 Bad Requeststatus code.BREAKING CHANGE:
Server-side requests will now fail with a
400 Bad Requesterror if theHostheader does not match a customized allowlist (or localhost).AngularAppEngine Users:
To resolve this, you must configure the
allowedHostsoption in yourangular.jsonto include all domain names where your application is deployed.Example configuration in
angular.json:CommonEngine Users:
If you are using
CommonEngine, you must now provide theallowedHostsoption when initializing or rendering your application.Example: