Previously, a downgraded component compiled whatever its element contained when the component was created. By then, AngularJS could already have linked or written content into the element, for example through `ng-transclude` or `ng-bind` on it, and that content was compiled again.
Previously, empty-path outlet groups in a request URL (such as `x:/(detail:2)`,
`///(detail:2)`, or `x:/()`) were allowed to match without a corresponding
route for that outlet name in the route configuration:
1. `processChildren` called `processSegmentGroup` for each child outlet,
which immediately delegated any zero-segment group with children back to
`processChildren` against the same parent `config` and `parentRoute`
without matching a route. Calling `processSegment` directly in
`processChildren` ensures only the root `UrlSegmentGroup` short-circuits
to `processChildren`.
2. `processSegmentAgainstRoute` allowed named outlets to pierce empty-path
routes for other outlets even when the route had no children to pierce into
or the URL segment group had no segments or children to pierce with.
3. `matchSegmentAgainstRoute` branched into `processChildren` or returned a
completed leaf match before `getOutlet(route) === outlet` was satisfied,
and did not require a descendant `TreeNode` match when piercing an
empty-path route for a different outlet.
4. `noLeftoversInUrl` only checked `!segmentGroup.children[outlet]` rather
than `!segmentGroup.hasChildren()`, allowing unmatched zero-segment outlet
groups with child outlets for other names to be treated as having no
leftovers instead of throwing `NoMatch`.
Together, these allowed crafted URLs with unconfigured zero-segment outlet
groups to fan out across empty-path routes (#70932) or repeatedly evaluate
guards and construct duplicate route snapshot subtrees across sibling outlets
(#70997). Requiring every child segment group to match a route for its outlet
before unwrapping children or completing a match prevents the invalid matches
at the source.
Fixes#70932Fixes#70997
Previously, resolveUrl only checked whether the raw URL string started with '//' before WHATWG URL resolution. When given an input such as '/.//evil.test', WHATWG dot-segment normalization popped the leading '/.', leaving a pathname starting with '//'. This corrupted ServerPlatformLocation and led to protocol-relative open redirects in SSR.
Now, resolveUrl also verifies that the normalized URL pathname does not start with '//' when allowProtocolRelative is false.
Fixes#71076
A URL group that consumes no segments is matched against the same config as
its parent, so a route can match once for every group the URL nests. Every
match lands in one sibling list, which the router cannot activate because
only one of them can own the outlet.
The check that rejects this ran only in development, and never covered the
siblings `mergeEmptyPathMatches` produces. Run it on every list the merge
returns instead.
Fixes#70997
An empty path route matches once for every outlet a URL names, so recognition copied the query params and the inherited params into as many snapshots as the URL asked for, at the width the URL chose. Share the frozen objects instead.
Fixes#70932
In 89d47d814d, RouterLink internals were
refactored to use signals, introducing a computed signal `_urlTree`.
Because every `<a routerLink>` maintains an active RouterLink directive
instance for the lifetime of the view/request, the computed signal
permanently cached the returned UrlTree (and its cloned queryParams map
and segment tree) in `ReactiveNode.value` for every link.
During server-side rendering (SSR), especially when query parameters are
large or when `defaultQueryParamsHandling: 'merge'` is enabled, each
rendered link held a full copy of the query parameter map pinned in the
heap. In an application with 100 links and thousands of query parameters,
this pinned over 50 MB of heap per in-flight request, causing server
workers to crash with Out of Memory (OOM) under concurrent load (#70908).
This change moves the reactive dependencies (`path`, `fragment`, and
`queryParams`) directly into `reactiveHref` so it computes and retains
only the serialized href string. The intermediate UrlTree and its
queryParams dictionary are discarded immediately after serialization and
collected during young-generation GC scavenges rather than remaining
pinned in the heap. The public `urlTree` getter and `onClick` handler now
compute the tree on demand, restoring the memory profile prior to
89d47d814d.
Fixes#70908
Keep numeric URL keys in V8 dictionary storage while parsing URLs and
copying segment groups. This avoids oversized allocations for each
segment without changing route matching or component input binding.
Fixes#70716
Prevent arbitrary MetaDefinition properties from writing on* handlers directly to meta elements. Browser events can execute these handlers, including on meta elements rendered in the document body.
Reject handler attributes case-insensitively before matching or mutating tags.
Fixes#70126
Represent withRequestsMadeViaParent() with an internal delegating backend so the interceptor handler can distinguish delegated clients from independent child configurations.
Normalize value-specific HttpHeaders deletions before filtering. The string overload previously used String#indexOf and removed shorter values contained within the requested deletion value, potentially widening outgoing request metadata.
Preserve delete-all behavior only when no value is supplied, and cover string, array, and empty-string deletion.
Prevent lazy HttpHeaders and HttpParams clones from reusing value arrays owned by a materialized source. Append and value-specific delete operations previously mutated those shared arrays, violating the immutable API contract and allowing request metadata to bleed into later requests.
Share value arrays until an update mutates a specific header or parameter, then copy only that array. Cover the affected append and delete paths with regression tests that materialize the source first.
Previously, the compiler disallowed translation of any attribute starting with 'on' for security reasons. This incorrectly disallowed translation of the 'on' attribute itself, which is not an event handler.
This commit introduces `isPossibleEventHandler` to verify that the property name has a length greater than 2 in addition to starting with 'on'. This allows attributes like 'on' to be translated while still correctly disallowing actual event handlers like 'onerror', 'onclick', etc.
Serialize transfer cache request parameters without comma-joining repeated values so distinct HttpClient requests cannot reuse the same cached response.
Include the XSRF interceptor in the root token factory so the automatically provided HttpClient retains the documented default protection without requiring provideHttpClient().
Preserve explicit referrer policy when the service worker reconstructs asset requests for cache-busted and redirected asset fetches.
For example, an application can load a script or image with referrerPolicy: 'same-origin' or 'origin' to limit referrer data. Dropping that policy can expose more of the current URL to that resource host.
(cherry picked from commit a7f52e5c30)
Preserve referrer metadata when the service worker reconstructs asset requests for cache-busted and redirected asset fetches.
For example, an attacker with access to asset host logs could receive a reset token embedded in a page URL if the reconstructed request falls back to default referrer behavior instead of carrying referrer: ''.
(cherry picked from commit 99ad47e58f)
Skip HttpTransferCache serialization for HTTP responses that contain a
Set-Cookie header.
Cookie-setting responses commonly represent session-specific,
user-specific, or security-sensitive state. Serializing their bodies into
SSR TransferState can embed sensitive data into the generated HTML, where
it may be reused during hydration or replayed by a shared cache/CDN.
(cherry picked from commit 80795defc6)
The previous fix for GHSA-692r-grfm-v8x7 was incomplete because it rejected script tags only when locating an explicit host element. Dynamic component instantiation can also infer the host element from the component selector.
Move the script-host rejection to the point where ComponentFactory has resolved the host element for either path, so createComponent rejects script hosts consistently.
(cherry picked from commit 135f3755b4)
Only cache locale data loaded from the global locale registry when an actual locale entry is found.
This prevents attacker-controlled missing locale identifiers from being retained indefinitely in SSR when locale lookup falls back to a parent locale or the built-in English locale, avoiding unbounded process memory growth in locale-aware pipes and formatters.
(cherry picked from commit ea8277ae37)
Normalize SVG animation attributeName lookup to also recognize lowercase attributename before allowing dynamic animation value bindings.
Add runtime and platform-server SSR regression coverage for lowercase attributename retargeting.
(cherry picked from commit d5e689af80)
XHR support in `@angular/platform-server` is deprecated because the underlying `xhr2` library does not safely handle redirects. Specifically, it can forward `Authorization` headers on cross-origin redirects (which leaks credentials) and is susceptible to denial-of-service (DoS) via redirect loops.
DEPRECATED: XHR support in `@angular/platform-server` is deprecated. Use standard `fetch` APIs instead.
Introduces a maximum length of 256 characters for date format strings.
This prevents potential Denial of Service (DoS) attacks by throwing an
`INVALID_DATE_FORMAT` error if an excessively long format string is
provided to `formatDate` or `DatePipe`, safeguarding against performance
degradation or application crashes.
(cherry picked from commit 35de6b368c)
Preserve `referrer: ''` when constructing and cloning HttpRequest.
An empty string is a valid Fetch referrer value and is documented by
Angular as the way to omit referrer information for sensitive requests.
The previous truthy checks treated it as if the option was not provided,
causing requests to fall back to the browser default referrer behavior.
(cherry picked from commit 1e54b8f5ec)