15080 Commits
Author SHA1 Message Date
Jaime Burgos bc74d72035 fix(upgrade): only compile the template contents of a downgraded component
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.
2026-10-28 16:42:44 -07:00
Andrew Scott a83f8119ac fix(router): require outlets to match a route before processing child segments
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 #70932
Fixes #70997
2026-09-30 07:42:17 -07:00
Alan Agius 450af9c813 fix(platform-server): reject protocol-relative paths in resolveUrl
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
2026-09-30 07:21:16 -07:00
SkyZeroZx 6489ca5d84 fix(router): reject duplicate outlets in production builds
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
2026-09-29 09:53:50 -07:00
SkyZeroZx 4bc11a546b fix(router): do not copy URL-sized objects into every route snapshot
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
2026-09-28 13:04:29 -07:00
Andrew Scott a131f77d92 perf(router): do not retain UrlTree instances in RouterLink
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
2026-09-28 10:24:30 -07:00
SkyZeroZx 03872a80bc fix(router): avoid dense elements allocation for numeric URL keys
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
2026-09-23 10:21:15 -07:00
Alan Agius fc2e8fbc0b fix(platform-server): update domino to latest version
Updates the domino dependency to the latest version as used in the main branch.
2026-09-09 16:28:26 +02:00
Alan Agius 5aa6d97deb fix(platform-server): avoid stripping unicode whitespace during url resolution
Avoid trimming urlStr with String.prototype.trim() in resolveUrl to ensure URL parsing and resolution align with the WHATWG URL standard.
2026-08-25 10:00:02 -07:00
Alan Agius 73d8bbd27c fix(platform-server): update domino to latest version
Updates the domino dependency to the latest version as used in the main branch.
2026-08-24 10:41:12 -07:00
SkyZeroZx c19a36c2fb fix(platform-browser): disallow event handler attributes in Meta
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
2026-08-17 13:43:57 -07:00
Jaime Burgos caf616670f fix(http): run root interceptors in the terminal request chain
Represent withRequestsMadeViaParent() with an internal delegating backend so the interceptor handler can distinguish delegated clients from independent child configurations.
2026-07-31 15:13:30 -07:00
SkyZeroZx fec5977df4 fix(http): match header values exactly when deleting
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.
2026-07-31 15:13:30 -07:00
SkyZeroZx e33d69a71c fix(http): preserve immutability of materialized clones
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.
2026-07-31 15:13:30 -07:00
Jaime Burgos 6afe6fa781 fix(core): sanitize host bindings on concrete hosts
Compute host binding security contexts against concrete hosts, including host directives, inheritance, dynamic directives, and createComponent hostElement usage.
2026-07-30 08:29:04 -07:00
Alan Agius 7b884f585a fix(compiler): restrict possible event handler check to property names longer than 2 characters
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.
2026-07-29 08:51:50 -07:00
Hexix23 948a8d6831 fix(http): distinguish repeated transfer cache params
Serialize transfer cache request parameters without comma-joining repeated values so distinct HttpClient requests cannot reuse the same cached response.
2026-07-29 08:51:50 -07:00
Hexix23 e2660c3dee fix(compiler): disallow i18n event attributes
Reject translated event-handler attributes so localization cannot bypass Angular event-attribute validation.
2026-07-29 08:51:50 -07:00
SkyZeroZx f34a93c946 fix(platform-server): update domino to latest version
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for https://github.com/angular/domino/pull/32.
2026-07-29 08:43:40 -07:00
Jaime Burgos 9949dccce1 fix(http): enable xsrf for root-provided HttpClient
Include the XSRF interceptor in the root token factory so the automatically provided HttpClient retains the documented default protection without requiring provideHttpClient().
2026-07-24 13:24:13 -07:00
SkyZeroZx e86c31bf26 fix(service-worker): preserve referrer policy in asset requests
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)
2026-07-08 11:24:32 -07:00
SkyZeroZx 1804f73bec fix(service-worker): preserve referrer in asset requests
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)
2026-07-08 11:24:32 -07:00
SkyZeroZx 91df739b80 fix(http): prevent caching of responses with Set-Cookie headers
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)
2026-07-07 10:15:02 -07:00
Alan Agius 8d22cc953b fix(compiler-cli): update babel dependencies to latest v7
Update babel dependencies to v7.29.7 to address CVE-2026-49356.

Fixes #69608
2026-07-06 14:01:46 -07:00
SkyZeroZx 5a693bafcd fix(core): reject dynamic script host elements
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)
2026-06-30 17:42:39 -07:00
SkyZeroZx 6bcce117fb fix(core): avoid caching missing locale data
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)
2026-06-24 13:04:05 -04:00
Jaime Burgos 88832c84f8 fix(core): validate lowercase SVG animation attribute names (#69269)
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)
2026-06-10 09:51:11 -07:00
Alan Agius 13fb0afe93 refactor(platform-server): deprecate ServerXhr (#69255)
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.
2026-06-09 10:06:45 -07:00
SkyZeroZx 86a56dc279 fix(common): Limits date format string length
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)
2026-06-08 13:19:55 -07:00
SkyZeroZx bcb1b7ea25 fix(http): preserve empty referrer option in HttpRequest
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)
2026-06-08 13:17:32 -07:00