Skip to content

docs(platform-server): add NG05703 error page and link it from the er…#69669

Open
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:fix/#69667
Open

docs(platform-server): add NG05703 error page and link it from the er…#69669
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:fix/#69667

Conversation

@MeAkib

@MeAkib MeAkib commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Add a dedicated error reference page for NG05703 (suspicious URL origin
change during SSR) and update the error to use RuntimeError with a
negative code so the error message automatically includes a link to the
docs page in both dev and production builds.

Update affected tests in url_spec.ts, platform_location_spec.ts, and
integration_spec.ts to match the new NG05703-prefixed error message
format.

Fixes: #69667

@pullapprove pullapprove Bot requested a review from kirjs July 7, 2026 15:54
@angular-robot angular-robot Bot added area: docs Related to the documentation area: server Issues related to server-side rendering labels Jul 7, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jul 7, 2026
@JeanMeche JeanMeche requested review from JeanMeche and alan-agius4 and removed request for kirjs July 7, 2026 16:00
Comment thread adev/src/content/reference/errors/NG05703.md Outdated
Comment thread adev/src/content/reference/errors/NG05703.md Outdated
@MeAkib MeAkib requested a review from JeanMeche July 7, 2026 18:53
Comment thread adev/src/content/reference/errors/NG05703.md Outdated
Comment thread adev/src/content/reference/errors/NG05703.md Outdated
@alan-agius4

Copy link
Copy Markdown
Contributor

Hello! I am a bot assistant review. To make this error documentation even more comprehensive, I suggest updating it to use the following version of NG05703.md.

This version incorporates the security context (such as preventing open redirect and SSRF bypasses via backslash-prefixed hijack attempts or obfuscated protocol schemes) which originally motivated this validation check, alongside the common SSR configuration issues.

Here is the proposed full content for NG05703.md:

# Suspicious URL Origin Change

This error occurs in Server-Side Rendering (SSR) environments when a URL resolution results in an unexpected origin change. This check is a security feature in `@angular/platform-server` designed to protect your application from Server-Side Request Forgery (SSRF) and security bypasses.

## Description

To perform HTTP requests and process route states during SSR, Angular must resolve relative URLs to absolute URLs.

During this resolution process, Angular validates that the resolved URL does not unexpectedly point to an external or untrusted origin. If a URL behaves like a relative path but resolves to a different origin, Angular throws `NG05703` and blocks the request/navigation.

### Common causes

* **Backslash-prefixed hijack attempts (open redirects / SSRF bypass):** Relative paths beginning with slashes and backslashes (such as `/\\attacker.com/path` or `\\\\attacker.com/path`) can be interpreted differently by browsers and server-side URL parsers. In some parser implementations, these resolve to an absolute URL pointing to `attacker.com`. Angular detects this mismatch and blocks the resolution.
* **Disallowed state changes to different origins:** Navigation or URL updates (e.g. using `location.replaceState` or `location.pushState`) that change the origin of the application when the environment is configured to restrict URL changes to the current origin only.
* **SSR bootstrap URL mismatch:** In server-side rendering, if the `url` passed to the renderer does not align with the base origin configured for the application (such as `APP_BASE_HREF`), the router might attempt to synchronize the location on startup, causing a disallowed origin change.
* **Obfuscated protocol schemes:** Absolute URLs with obfuscated or malformed protocols (e.g. `ht\ntp://evil.com/path`) that attempt to bypass origin checks.

## Debugging the error

Check the URL that triggered the error. Ensure it does not contain unexpected backslashes, line breaks, or other characters that could trigger parsing anomalies:

* Avoid using backslashes (`\`) in relative URLs or routing paths.
* Make sure any user-supplied URLs or query parameters are properly validated and sanitized before being processed in SSR.
* **Align SSR bootstrap URL with configured base URL:** If the error occurs on startup in an SSR environment, ensure that the `url` passed to the renderer matches the expected base origin/host (e.g. `APP_BASE_HREF`). Avoid using dynamic URLs from raw request headers (like `X-Forwarded-Host`) if they do not match the trusted application origin.
* If you intentionally want to make requests to a different domain via a protocol-relative URL (`//other-domain.com/path`), ensure it is allowed by the configuration or use an explicit scheme (`http://` or `https://`).

…up RuntimeError

Add a dedicated error reference page for NG05703 (suspicious URL origin
change during SSR) and update the error to use RuntimeError with a
negative code so the error message automatically includes a link to the
docs page in both dev and production builds.

Update affected tests in url_spec.ts, platform_location_spec.ts, and
integration_spec.ts to match the new NG05703-prefixed error message
format.

Fixes: angular#69667
@MeAkib

This comment was marked as resolved.

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Jul 9, 2026
@pullapprove pullapprove Bot requested review from atscott and kirjs July 9, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: docs Related to the documentation area: server Issues related to server-side rendering target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error NG05703 on SSR serve

3 participants