37581 Commits

Author SHA1 Message Date
Andrew Scott 8b325594ae release: cut the v22.0.1 release v22.0.1 2026-06-10 13:16:24 -07:00
Matthieu Riegler 2dd65d21e6 fix(http): pass down the reportUploadProgress and reportDownloadProgress on post/patch requests
The `addBody` function did not pass the argument correctly

fixes #69241

(cherry picked from commit c092a002e4)
2026-06-10 18:37:50 +00:00
SkyZeroZx b416da67c1 docs: add caching guidance for resource data with SSR
(cherry picked from commit 274d1d2dcc)
2026-06-10 18:27:48 +00:00
Angular Robot 79de82799f build: update cross-repo angular dependencies
See associated pull request for more information.
2026-06-10 11:24:10 -07:00
Andrew Scott f6695b0eb2 fix(vscode-extension): resolve relative workspace tsdk paths to absolute
Resolve the approved relative workspace tsdk path to an absolute path by checking workspace folders. This ensures the path is correctly resolved on the server side.

Fixes #69276

(cherry picked from commit fbe807ca12)
2026-06-10 18:10:00 +00:00
Andrew Scott 4645850e24 refactor(compiler): Remove 80 char limit on AbstractEmitterVisitor
This limit breaks ts-ignore comments when using this for our source->source transform.
Rather than overridding it there, it's just removed here since we don't care about the limit

(cherry picked from commit 54112d9393)
2026-06-10 17:57:30 +00:00
aparziale 48996d3ab2 docs: update webpack-based system docs
Update webpack-based system docs

Fixes #69279

(cherry picked from commit 8854f2d476)
2026-06-10 17:54:46 +00:00
Andrew Scott 4b0c3b8b8f refactor(core): Update registerNgModuleType to support codegen typechecking
Updates types and adds test for source->source transformation with tsc downstream

(cherry picked from commit d25d2e1524)
2026-06-10 17:53:00 +00:00
Andrew Scott 3f055435f6 refactor(forms): fix initWebMcpForm description to be required
updates from breakage in https://github.com/angular/angular/commit/c121407c0da2456543a54822941d71a75490b703

(cherry picked from commit a7e7a2cf05)
2026-06-10 17:51:20 +00:00
Doug Parker dbf64c8eb5 test(core): fix AI tools test flake
This test flakes occasionally because it is called in production when a platform is created and unregistered when a platform is destroyed. However, not all tests properly clean up their platforms, meaning we can accidentally leak platforms between tests. If this happens, we end up have an event listener created from the production code path and a second event listener from the test. When the test emits the event, both listeners respond and it causes too many responses which fails the test.

Ideally, all tests would clean up the platforms correctly, but this seems difficult to guarantee for all Angular tests and is likely to break over time. The simplest solution is just destroy any leaked platform before the test starts. It's a bit elegant, but the safest option.

(cherry picked from commit 492e3a2a1f)
2026-06-10 17:29:05 +00:00
SkyZeroZx 045bb736b3 fix(core): validate lowercase SVG animation attribute names
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 e640692452)
2026-06-10 17:22:34 +00:00
Hexix23 1ee224ca30 fix(compiler): disallow i18n event attributes
Reject translated event-handler attributes so localization cannot bypass Angular event-attribute validation.

(cherry picked from commit 6c41f5ca01)
2026-06-10 17:21:38 +00:00
SkyZeroZx 1bd5a562f5 docs: deprecate XHR support for server-side rendering in HTTP docs and recommend Fetch
(cherry picked from commit 2066225244)
2026-06-10 17:20:43 +00:00
arturovt 3c2892c8df fix(common): prevent prototype pollution in formatDateTime
Replace `in` operator with `Object.hasOwn` in
formatDateTime to prevent prototype pollution attacks.

The `in` operator traverses the prototype chain, meaning a polluted
Object.prototype key could be picked up as a valid replacement value.
This is especially critical in SSR environments where a single
prototype pollution attack persists across all subsequent requests in
the shared Node.js process, potentially injecting malicious content
into every user's rendered HTML.

Using `Object.hasOwn` restricts the lookup to
own properties only, blocking prototype chain traversal.

(cherry picked from commit 1ec125276d)
2026-06-10 17:19:34 +00:00
Matthieu Riegler 11836a670a fix(forms): delay mcp reading the form model by a tick
Reading the form model on init is unsafe as it could depend on inputs (eg a required input). We need to delay the read by a tick (after the inputs are set) to ensure that values can be safely read.

fixes #69262

(cherry picked from commit 9604ecfd8b)
2026-06-10 17:14:45 +00:00
Matthieu Riegler 5946c18275 fix(compiler): sanitize href/xlink:href attributes of any element of the MathML namespace
The ensures that future, present and past (and precated) elements of that namespace get sanitized.

(cherry picked from commit 3927a5b271)
2026-06-10 17:13:53 +00:00
arturovt e51ad374ea fix(forms): remove animationstart listener on component destroy to prevent memory leak
The `watchValidity` method in `AnimationInputValidityMonitor` was registering
an anonymous arrow function via `addEventListener` with no corresponding
`removeEventListener` call.

In V8, each closure is represented as a `JSFunction` holding a strong pointer
to a heap-allocated `Context` object containing captured variables
(`VariableLocation::CONTEXT` slots, decided at parse time by
`Scope::MustAllocateInContext`). In Blink, DOM event listeners are stored in
the element's `EventTargetData::event_listener_map` as `JSEventListener`
wrappers backed by a `v8::Persistent<JSFunction>` handle — a strong cross-heap
reference that keeps the function alive as long as the element is alive.

Because the callback passed to `watchValidity` closes over the calling
component/directive (which itself holds a reference back to the element), this
produced a cross-heap reference cycle:

```
  HTMLInputElement (Blink/Oilpan)
    └── EventTargetData → JSEventListener → v8::Persistent<JSFunction>
          └── Context → callback closure
                └── component → HTMLInputElement  ← cycle
```

Neither V8's nor Blink's GC could independently break this cycle because it
crosses the V8/Oilpan heap boundary. The element was therefore never collected
after being removed from the DOM.

The fix stores the listener in a named local variable and registers its removal
via `DestroyRef.onDestroy`, tying cleanup to the lifetime of the component that
owns the element. This ensures `removeEventListener` is called with the exact
same `JSFunction` reference, causing Blink to drop the `v8::Persistent` handle
and allowing both the function and the element to become GC-eligible.

(cherry picked from commit 6cc54e5ede)
2026-06-10 16:56:20 +00:00
Kristiyan Kostadinov b1f02eb5c5 refactor(core): add internal utility
Sets up a utility function that we need for an internal project.

(cherry picked from commit 158307cd63)
2026-06-10 16:54:40 +00:00
Matthieu Riegler 85d2d100e3 fix(forms): harden FormGroup control lookups against prototype shadowing
Guard FormGroup control-map presence checks with safe own-property checks to avoid inherited/prototype collisions from reserved keys such as hasOwnProperty and toString.

This prevents:
- crashes from shadowed hasOwnProperty access paths
- incorrect early-return and existence behavior for prototype-named controls

Adds regression tests for prototype-shadowed keys covering:
- register/add with toString
- contains/get with hasOwnProperty
- setControl/removeControl with toString
- FormRecord behavior with hasOwnProperty

(cherry picked from commit f06b96d181)
2026-06-10 02:28:00 +00:00
Matthieu Riegler 6e3d51d7df refactor(migrations): Improve safeNavigationMigration heuristic
There is no need to migrate expressions with a nullish comparison.

fixes #69274

(cherry picked from commit 6b0150faad)
2026-06-10 00:11:59 +00:00
Andrew Scott 01ea640539 refactor(core): Fix DirectiveDefinition interface to allow abstract classes
Interface should permit abstract classes since directives can be abstract

(cherry picked from commit d1539a8513)
2026-06-09 23:21:08 +00:00
Jad Chahed a704b08379 docs: add Signal Forms and v22 guidance to AI best-practices and llms.txt
Update the AI codegen resources for Angular v22:
- best-practices.md: OnPush is the default in v22+ (don't set it explicitly),
  recommend Signal Forms, and recommend the @Service decorator.
- llms.txt: add a Signal Forms reference, the httpResource guide, and an
  Accessibility section linking the Angular Aria overview.

(cherry picked from commit 248e9c146d)
2026-06-09 21:00:00 +00:00
Andrew Scott 43a0e28729 fix(language-service): prevent external template inlay hints from appearing in TS files
Inlay hints from external templates were being incorrectly applied to
TypeScript files because the compiler was processing all templates
associated with components found in the TS file, regardless of whether
the template was inline or external. This resulted in misplaced hints
due to mismatched offsets.

This change filters the templates and host bindings processed in
getInlayHintsForTemplate to only include those that belong to the
target file being queried.

Fixes #69224

(cherry picked from commit 2e4ed8027d)
2026-06-09 20:33:19 +00:00
Angular Robot fe6c5d717f build: update cross-repo angular dependencies
See associated pull request for more information.
2026-06-09 13:31:56 -07:00
Kam 4d24f465e3 fix(docs-infra): load cross-origin video embeds under COEP credentialless
adev is cross-origin isolated (COOP same-origin + COEP require-corp) so the
embedded WebContainer editor can use SharedArrayBuffer. Under require-corp the
cross-origin YouTube iframe in `<docs-video>` only loaded in Chromium, leaving
the player blank in Safari.

Switch COEP from `require-corp` to `credentialless`. The page stays cross-origin
isolated, so the editor keeps working, but cross-origin frames are now allowed
to load, which restores the inline player in Safari as well.

(cherry picked from commit 86cd166141)
2026-06-09 20:26:24 +00:00
Kristiyan Kostadinov 4289c4c840 fix(core): update comment for Default change detection
Updates the comment on `ChangeDetectionStrategy.Default` to mention that it's the same as `Eager`.

Fixes #69253.

(cherry picked from commit 5829177729)
2026-06-09 20:10:04 +00:00
Andrew Scott 562a566ead fix(core): Handle synchronous errors in PendingTasks.run function
catches synchronous errors coming out of the function passed to PendingTasks.run

(cherry picked from commit 0e16bb701f)
2026-06-09 19:24:26 +00:00
Andrew Scott 43edc8410f fix(router): use native URL object for navigation boundary and comparison
Previously, `NavigationStateManager` relied on string-based comparisons and `.substring()` to match `NavigateEvent` URLs against internal router transitions or the application root boundary. This was brittle against trailing slashes, query parameter order variations, and sibling application URLs.

This commit updates the logic to:

- Use the native `URL` object to strictly compare `origin` and `pathname` for `appRootURL` boundaries.

- Sort `searchParams` and use `Location.stripTrailingSlash()` to robustly compare the router destination against the event destination.

- Pre-compute and store `appRootUrl` as a `URL` object to avoid redundant parsing on every navigation.

(cherry picked from commit fe721868a6)
2026-06-09 11:15:20 -07:00
arturovt c4b5fa3c92 fix(common): escape CSS string-terminating characters in escapeCssUrl
The `escapeCssUrl` helper used by `NgOptimizedImage` to sanitize placeholder URLs for use in the `background-image` CSS property previously escaped only backslashes and double quotes. However, several characters that can terminate a CSS quoted string according to the CSS Syntax Level 3 specification were left unescaped, allowing a crafted placeholder URL to break out of the `url("...")` context and inject arbitrary CSS.

This change additionally escapes the following characters using CSS hex escapes:

* `U+000A` (LINE FEED) → `\A `
* `U+000D` (CARRIAGE RETURN) → `\D `
* `U+000C` (FORM FEED) → `\C `
* `U+0000` (NULL) → `\0 `

For example:

```text id="1w5vkp"
x.com/img\nx.jpg  →  x.com/img\A x.jpg
x.com/img\rx.jpg  →  x.com/img\D x.jpg
x.com/img\fx.jpg  →  x.com/img\C x.jpg
x.com/img\0x.jpg  →  x.com/img\0 x.jpg
```

The trailing space is required by the CSS tokenizer to terminate the escape sequence and prevent the following character from being interpreted as part of the escape.

The backslash replacement remains first in the chain to avoid double-escaping the backslashes introduced by subsequent replacements.

(cherry picked from commit 3dd35c242c)
2026-06-09 10:40:25 -07:00
cexbrayat cdcea80327 fix(core): require WebMCP tool descriptions
The WebMCP ModelContextTool dictionary marks description as required: https://webmachinelearning.github.io/webmcp/#modelcontexttool-dictionary

(cherry picked from commit c121407c0d)
2026-06-09 10:29:15 -07:00
Matthieu Riegler f908a3e6bf refactor(core): harden change store access
This prevents any attack through prototype polution.

(cherry picked from commit bff084f203)
2026-06-09 17:05:58 +00:00
Kam 8ddda4d0aa fix(docs-infra): improve version picker dropdown positioning
Drops `position: absolute` from the version picker `<ul>` and tightens `max-height` to `70dvh` so the cdk-overlay-pane fits the viewport and the inner scroll reaches the last versions on mobile and desktop.

(cherry picked from commit 7d92cc8b46)
2026-06-09 16:58:26 +00:00
Alan Agius 1881ede3a7 refactor(platform-server): deprecate ServerXhr
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.
(cherry picked from commit 8446e46f8b)
2026-06-09 16:54:21 +00:00
Matthew Beck 96b6419d95 ci: run benchmark comparison in isolated worktree and harden security
- Run comparison benchmark in an isolated git worktree to prevent workspace pollution and local branch conflicts.
- Harden security by passing benchmark target and SHA as environment variables to prevent shell injection, and adding '--' to bazel query and git rev-parse.
- Optimize workflow by removing pnpm caching to mitigate cache poisoning risks.
- Improve robustness of benchmark log parsing, supporting both ZIP outputs and raw directories, and safely checking for JSON reports.
- Centralize git command execution on the dev-infra GitClient for consistency.
- Add tslib to benchpress dependencies to prevent module resolution failures.

(cherry picked from commit 547d85addf)
2026-06-09 16:48:55 +00:00
SkyZeroZx 4254eb416c 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 cd771d3712)
2026-06-09 16:41:24 +00:00
SkyZeroZx cf97b1f828 fix(service-worker): Strips sensitive headers on cross-origin redirects
Removes `Authorization`, `Cookie`, and `Proxy-Authorization` headers when a request is redirected to a different origin. This aligns with the Fetch API's redirect algorithm to prevent sensitive information from being sent to third-party origins.

(cherry picked from commit 47d68dcb26)
2026-06-08 21:49:34 +00:00
Kam 35a8c28656 docs: fix CurrencyPipe locale override example
The "Override current locale for CurrencyPipe" example used `{{ amount | currency: 'en-US' }}`, but the first `CurrencyPipe` argument is the currency code, not the locale, so `'en-US'` was treated as an invalid currency code (rendered literally as the symbol) and the locale was never overridden. Since `locale` is the fourth positional argument, the example now passes a valid currency code, display, and digits before it (`'USD' : 'symbol' : '1.2-2' : 'en-US'`), matching the parameter order shown on the CurrencyPipe API page.

(cherry picked from commit a82f822057)
2026-06-08 21:36:21 +00:00
KirtiRamchandani e7dae12c3d fix(docs-infra): avoid code copy button overlap
Reveal code copy controls on hover and focus so long code snippets stay readable while keyboard access and copy state feedback remain intact.

(cherry picked from commit b7cb5844cf)
2026-06-08 21:19:54 +00:00
SkyZeroZx 167bd4c162 fix(http): Rejects non-HTTP(S) URLs in JSONP requests
Prevents JSONP requests from using URLs with unsupported protocols for improved security.

Fixes #68832

(cherry picked from commit 231eff19a1)
2026-06-08 13:56:46 -07:00
SkyZeroZx 393b84caf8 fix(compiler): sanitize two-way properties
Apply schema-derived sanitizer resolution to TwoWayProperty ops so native two-way DOM bindings emit the same sanitizer as one-way property bindings.

Add compiler compliance coverage for innerHTML, srcdoc, URL, resource URL, and security-sensitive attribute cases.

(cherry picked from commit 3c70270c96)
2026-06-08 20:12:27 +00:00
Bhuvansh855 60d88b11bd docs: fix malformed prettier-ignore comment in whitespace guide
(cherry picked from commit 422e6893e4)
2026-06-08 19:59:29 +00:00
aparziale 54fa77adc1 docs: close menù with click outside container
close menù with click outside container

Fixes #69222

(cherry picked from commit dc8165e253)
2026-06-08 19:58:03 +00:00
Matthieu Riegler b310d718d9 docs: mention required behavior for booleans
fixes #68509

(cherry picked from commit 9cfd3f52e1)
2026-06-08 19:54:44 +00:00
Aleksander Bodurri 61dbc2bf91 feat(devtools): improve transfer state tab
- promote to default-on (remove opt-in setting and gear-menu toggle)
- replace the <pre> value cell with a collapsible JSON tree
- add key filter and column sort (size sorts by raw bytes)
- show an educational empty state when the app has no transfer state
- iterate every root in the directive forest and merge their state
- guard size calculation against undefined and circular references
- register listener once with DestroyRef cleanup; add a loading timeout
- distinguish array/string badge colors via theme-aware tokens
- responsive value cell width; flex-based table scroll
- add a component spec; seed the harness fixture with more demo data

(cherry picked from commit 06db706238)
2026-06-08 19:47:19 +00:00
Matthieu Riegler a99b7e49e9 ci: add myself to size-tracking
I feel confortable reviewing those

(cherry picked from commit 51724b48d2)
2026-06-08 18:52:24 +00:00
Angular Robot 51d5f3be94 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-06-05 11:12:02 -07:00
arturovt d4e08da89d refactor(core): convert LocaleDataIndex from enum to const object
TypeScript enums compile to self-executing function expressions that
are not tree-shakable, even when unused. Replace LocaleDataIndex with
a plain const object using `as const` to produce the same numeric
indices and literal types without the IIFE side-effect.

(cherry picked from commit d3239a3ac2)
2026-06-05 18:10:47 +00:00
Angular Robot d58ef64646 build: update all github actions
See associated pull request for more information.
2026-06-05 11:02:38 -07:00
SkyZeroZx dfff57ede9 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 eeb03f4ea3)
2026-06-05 17:58:41 +00:00
Kam 70d038774c docs: trim transparent padding from v22 event hero image
The v22 event hero PNG shipped with a wide transparent margin baked into
its 960x540 canvas. Under the shared `img { width: 100% }` rule that empty
border stretched along with the artwork, leaving visible space around the
image. Trims the canvas to the artwork bounds (831x473) so it renders
flush; the retained pixels are unchanged and the file shrinks from about
795 KB to 568 KB.

(cherry picked from commit af7cb63151)
2026-06-05 17:56:32 +00:00