37033 Commits

Author SHA1 Message Date
Pawel Kozlowski 03188ddc9f release: cut the v21.2.16 release v21.2.16 2026-06-03 14:29:59 +02:00
Matthieu Riegler 736c4ab7e6 refactor(core): fix broken unit test.
This was broken by 3fd6897
2026-06-02 14:17:05 +02:00
Matthieu Riegler 3fd6897a67 fix(core): harden inherit definition feature against polluted prototypes
Stop inheritance traversal before built-in prototype objects and only read `ɵcmp`/`ɵdir` when they are own properties of a super type. This prevents polluted inherited properties from being treated as Angular defs during inheritance merging.

Also adds regression tests covering polluted `Object.prototype.ɵdir` and `Object.prototype.ɵcmp` to ensure polluted host metadata is not inherited.

(cherry picked from commit e695379354)
2026-06-02 13:26:00 +02:00
Michael Small db157e4aff docs: fix min/max form template examples
(cherry picked from commit 42391329c2)
2026-06-02 11:23:07 +02:00
Joey Perrott 70af5e8abd fix(docs-infra): secure update-assets script against RCE and SSRF
- Validate storedSha and storedBranch from _build-info.json.
- Validate latestSha returned from GitHub API.
- Validate branch in GithubClient.getShaForBranch and baseSha/headSha in GithubClient.getAffectedFiles.
- Use execFileSync instead of execSync to avoid shell execution.

TAG=agy
CONV=4e3e69ba-3f3d-416b-9ce4-9ef75486d2f3

(cherry picked from commit 3093edcad0)
2026-06-02 11:22:02 +02:00
Alan Agius 66821c4ed5 fix(platform-server): throw on suspicious URLs and restrict protocol-relative URLs
Currently, the platform-server attempts to neutralize URL hijacking and SSRF
bypasses by collapsing multiple leading slashes in relative paths. However,
sophisticated bypasses using obfuscated protocols (e.g., carriage returns or
newlines) or relative-like backslash paths can still lead to unexpected
origin takeovers.

This commit improves security by doing the following:
- Rejects protocol-relative URLs by throwing an error if they are not
  explicitly permitted via `allowProtocolRelative`.
- Strictly validates resolved URLs against the provided origin using
  `isSafeOriginChange`. If a URL unexpectedly shifts origins, an error
  is thrown.
- Permits origin changes only when standard absolute http/https protocols are
  explicitly declared in the input URL.

(cherry picked from commit 0b19c92d44)
2026-06-01 20:03:28 +02:00
Matthieu Riegler b74fb76d1a docs(docs-infra): simplify code block styles
#68940 introduced a regression that broke style for wrapped `code` blocks.
Simplifying the style by droping the unecessary gradient + before workaround fixes the issue.

(cherry picked from commit ec4f08bb94)
2026-06-01 18:36:58 +02:00
KirtiRamchandani 66d09558b6 docs: mention Angular Aria in accessibility guide
(cherry picked from commit 9b5952e3a3)
2026-06-01 18:33:36 +02:00
Kristiyan Kostadinov ae1c8a1f7a fix(compiler): move projection attributes into constants
We can save some memory by moving the `attrs` passed into the `projection` instruction into the constant pool.

(cherry picked from commit f0b28f6443)
2026-06-01 12:28:34 +02:00
Kam 9f6fda6815 docs: fix esbuild and TensorFlow branding on overview page
The esbuild card on the "What is Angular?" page rendered the bundler name three different ways (title "esbuild", link "ESBuild and Vite", body "Vite and ESBuild") so this unifies on the official lowercase "esbuild"; also corrects "Tensorflow" to "TensorFlow" to match the other brands on its line (Firebase, Material Design, Flutter, Google Cloud) which were already cased correctly.

(cherry picked from commit f777dd112e)
2026-06-01 12:19:08 +02:00
arturovt 1e5d76bfd9 docs: document //i18n(ph="name") placeholder syntax for template interpolations
The `//i18n(ph="name")` comment syntax for naming interpolation placeholders
in templates was not documented anywhere in the i18n guide, despite being a
supported compiler feature with test coverage.

Add a "Name the interpolation placeholder" subsection under "Mark text in
component template" in prepare.md, mirroring the existing subsection in
"Mark text in component code". Includes a cross-reference to the $localize
equivalent (`${var}:name:`) to help readers connect the two approaches.

Closes #52070

(cherry picked from commit 2b44a07ea7)
2026-06-01 12:18:09 +02:00
aparziale 22dd53ca97 docs: fix link debbuging and extended-diagnostics
Update link for 'Improve debbuging with better Angular error messages' and 'extended-diagnostics' sections

Fixed #69010

(cherry picked from commit cbc36f59e0)
2026-06-01 12:17:03 +02:00
Kam 1cd4f54aef fix(docs-infra): readable contrast for DEV/EXP api badges in light mode
The DEV (developer preview) and EXP (experimental) badges in the API reference list used `--page-background` for text, which is dark in dark mode (working as intended on the pale colored bg) but white in light mode, making the labels invisible against the near-white badge bg. Introduce an `--item-attr-text` CSS variable defaulting to `--page-background` and overridden to `--primary-contrast` in light mode, following the per-mode pattern the file already uses for `--item-attr-base-mix`.

(cherry picked from commit 0010ad5910)
2026-06-01 11:57:54 +02:00
Bhuvansh855 9d8ea2cc9a docs(forms): remove hasMetadata references from v21 guide 2026-06-01 11:56:00 +02:00
Kristiyan Kostadinov 69c0d48a0d fix(docs-infra): round up media queries
Uses 1px increments for media queries, rather than the 0.01px we have now which seem to be a bit too precise and cause the UI to be stuck between states in some cases.

I've also removed some unnecessary `calc`, because the calculation is happening inside Sass already.

Fixes #69020.

(cherry picked from commit 96ed0fe45b)
2026-06-01 11:34:44 +02:00
arturovt 7e38336dc7 fix(core): use Object.create(null) for LOCALE_DATA as a hardening measure
Prior to this commit, `LOCALE_DATA` was initialized as a plain object literal:

```typescript
let LOCALE_DATA: {[localeId: string]: any} = {};
```

While `__proto__` is neutralized by the `replace(/_/g, '-')` sanitization step (becoming `--proto--`), keys like `constructor` and `prototype` pass through unchanged and would modify special properties on `Object.prototype` if used as bracket notation keys on a plain object.

**Example attack through the public API:**

```typescript
// attacker calls the public registerLocaleData API with a crafted localeId
registerLocaleData(data, 'constructor');

// internally becomes:
LOCALE_DATA['constructor'] = data;
// → modifies Object.prototype.constructor for every object in the process

// or with extraData:
registerLocaleData(data, 'constructor', extraData);
// LOCALE_DATA['constructor'][LocaleDataIndex.ExtraData] = extraData;
// → Object.prototype[LocaleDataIndex.ExtraData] = extraData
// → every plain object in the process now has this property
// → affects JSON serialization, property enumeration, and framework internals

// consequence — any subsequent object created in the process is affected:
const user = getUserFromSession();
console.log(user[LocaleDataIndex.ExtraData]); // → attacker-controlled value
```

In a long-running SSR server this pollution persists for the lifetime of the process and affects all subsequent requests from all users.

**The fix** initializes `LOCALE_DATA` with `Object.create(null)`:

```typescript
let LOCALE_DATA: {[localeId: string]: any} = Object.create(null);
```

A null-prototype object has no prototype chain, so any key is treated as a plain string with no special behavior, making prototype pollution impossible regardless of input — without relying on the sanitization step as the sole protection.

(cherry picked from commit 0deac976f3)
2026-05-29 14:55:53 +02:00
arturovt 34c4e401ba fix(zone.js): validate __Zone_symbol_prefix to prevent DOM clobbering attacks
Previously, `__Zone_symbol_prefix` was read directly from `globalThis` without validating its type:

const symbolPrefix = global['__Zone_symbol_prefix'] || '__zone_symbol__';

This made it possible for DOM clobbering to interfere with Zone’s internal symbol handling. If an attacker injected a DOM element with the same name (for example via a form field or anchor ID), `global['__Zone_symbol_prefix']` could resolve to a DOM element instead of a string. Because DOM elements are truthy, the fallback would not be used, and Zone would construct invalid internal keys (e.g. “[object HTMLFormElement]...”), breaking patching and lookup logic in subtle ways.

This prevents DOM clobbering from influencing Zone’s internal symbol generation and keeps the patching system stable even in the presence of malicious or unexpected global values.

(cherry picked from commit e50f504b2f)
2026-05-29 14:54:19 +02:00
rootvector2 f6d8e642b0 fix(common): only strip a literal /index.html suffix from URLs
Hit this while exercising `Location.normalize` with route paths that end in non-`.html` suffixes.

The unescaped `.` in the strip regex inside `_stripIndexHtml` matches any character, so e.g. `/foo/indexXhtml` and `/foo/index_html` both collapse to `/foo` before the base-path strip and end up resolving to the wrong route.

Escape the dot so only the literal `/index.html` suffix is stripped.

(cherry picked from commit d109bf90d5)
2026-05-29 13:16:08 +02:00
Alan Agius 8206972189 refactor(platform-server): clean up and simplify url resolution utility
Trims leading/trailing whitespaces in resolveUrl to normalize input.

(cherry picked from commit e14d34e9ee)
2026-05-29 13:14:13 +02:00
Alan Agius d3170031b6 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/29.
2026-05-29 13:12:01 +02:00
arturovt 9b7d0e5034 docs: document i18n object forms for sourceLocale and locales in angular.json
The `sourceLocale` and `locales` entries in `angular.json` accept object
forms (with `code`, `baseHref`, and `subPath`) that were never documented.

- Add an `i18n options` reference section to workspace-config.md covering
  the full shape of `sourceLocale` and each `locales` entry, including the
  distinction between `baseHref` (HTML only) and `subPath` (HTML + output
  directory name)
- Add `i18n` to the project configuration options table in workspace-config.md
- Expand the suboptions table in merge.md to mention the object forms and
  link to the new reference section

Closes #59664

(cherry picked from commit 2f49d5dba4)
2026-05-29 11:53:54 +02:00
Alex Rickabaugh cea6588bb3 release: cut the v21.2.15 release v21.2.15 2026-05-28 09:51:14 -07:00
Kam 6b8202eab6 refactor(docs-infra): extract magic 27 in navigation-list tooltip threshold
The matTooltip on navigation list items was disabled when the label was
shorter than the literal `27`, repeated across four bindings in the
template. Lift the value to a protected readonly field so the threshold
has a name and lives in one place.

(cherry picked from commit 34d577f697)
2026-05-28 16:08:16 +02:00
Alan Agius eb1cbbf2eb fix(compiler): prevent namespaced SVG <style> elements from being stripped
Updates the template preparser to exclude namespaced SVG style tags (':svg:style') from the style elements set.

Previously, ':svg:style' elements were incorrectly classified as PreparsedElementType.STYLE, which caused them to be completely stripped from the final template DOM tree during the Render3 template transform and pushed into standard component stylesheets. By limiting the style element parsing to standard 'style' tags, namespaced SVG style tags remain safely in the template AST as normal DOM elements, preserving local SVG styling.

Closes #68977

(cherry picked from commit ec138c3645)
2026-05-28 14:02:52 +02:00
Bhuvansh855 8538bdce1c docs: fix grammar issues in resource guide
(cherry picked from commit 0e6cb4151c)
2026-05-28 13:48:06 +02:00
Yenya030 582a417bd2 fix(http): exclude withCredentials requests from transfer cache
Update the transfer cache check to safely exclude all requests sent with the `withCredentials` flag.

By default, the HTTP transfer cache avoids caching user-specific responses to prevent sensitive data exposure or incorrect caching. While requests with explicit headers like `Cookie` or `Authorization` are excluded by default, requests can also be sent with credentials via the `withCredentials` flag without having those headers explicitly declared on the request object.

To keep user-specific responses from being cached, exclude `withCredentials` requests unconditionally, even when the `includeRequestsWithAuthHeaders` option is set to true.

(cherry picked from commit 34090cb12e)
2026-05-27 14:13:21 -07:00
Yenya030 5c6d6df34b fix(http): skip TransferCache for cookie-bearing requests by default
Treat requests with a Cookie header like other auth-bearing requests and skip TransferCache caching them by default.

This preserves the explicit opt-in path via includeRequestsWithAuthHeaders, adds regression coverage for cookie-bearing requests, and updates the SSR guide to document the behavior.

(cherry picked from commit ab459798d9)
2026-05-27 14:13:21 -07:00
RonGamzu 29ceeffd40 docs: fix typos in source code comments
(cherry picked from commit 6f56202755)
2026-05-27 11:18:26 -07:00
Ricardo Chavarria 1a84668f0c docs(docs-infra): add Spanish community translation
Add https://docs.angular.lat/ (Español) to the community translations section.

(cherry picked from commit 48b4625fb3)
2026-05-27 11:16:59 -07:00
Kam 551a2a1f46 docs: fix preposition in libraries naming callout
The naming callout said the ng- prefix is "used from the Angular framework". Change to "used by", matching standard usage and the surrounding prose.

(cherry picked from commit 8c3e46fb53)
2026-05-27 11:09:46 -07:00
Harmeet Singh 84c6579a4e docs: clarify signals effect import source
(cherry picked from commit 741fcc4abf)
2026-05-27 11:08:54 -07:00
Kam 2b17b2db88 refactor(language-server): drop duplicate isAngularCore helpers in session
session.ts defined isAngularCore, isExternalAngularCore, and
isInternalAngularCore as byte-identical copies of the already-exported
versions in utils.ts. Only isAngularCore was used locally; the other
two were dead. handlers/template_info.ts already imports the utils
version. Remove the duplicates and import isAngularCore from utils.

(cherry picked from commit d808866f89)
2026-05-27 10:52:54 -07:00
Bhuvansh855 fd3573d99d fix(docs-infra): improve inline code layout
Remove inline-block layout behavior from inline code elements
to improve wrapping and spacing in multiline documentation
paragraphs.

(cherry picked from commit fdf0bf9a62)
2026-05-27 10:52:19 -07:00
Joey Perrott ef38852213 ci: configure setup and use pnpm in benchmark comparison workflow
The benchmark comparison workflow fails because it runs pnpm install
without setting up node and pnpm first. We configure the setup steps
manually so that checkouts from forks are supported.

Additionally, we update the benchmark comparison script (index.mts)
to use pnpm rather than hardcoded yarn commands to install
dependencies when checking out revisions.

(cherry picked from commit a648e8e914)
2026-05-27 10:51:43 -07:00
Alan Agius 2232a62bb2 fix(dev-infra): draft GitHub release to support immutable releases
Update the release tool to create the GitHub release in a draft state initially and publish it only after the extension asset (.vsix) has been successfully uploaded.

GitHub shifted towards immutable releases. If a release is published instantly upon creation,the assets will not be able to be uploaded.

(cherry picked from commit 26f4ed5056)
2026-05-27 10:50:26 -07:00
Andrew Scott ad5053b518 fix(zone.js): avoid type error on custom object rejection with rejection property
Ensure that when a custom object with a 'rejection' property is thrown as a raw promise rejection, the unhandled promise rejection error logger does not crash with a TypeError while trying to access undefined zone properties.

Also wrap microtask queue draining and task frame counter updates with defensive try-finally blocks to guarantee internal scheduler states are properly reset under any potential call stack exception unwinding scenarios.

(cherry picked from commit fa7580061b)
2026-05-27 10:45:19 -07:00
SkyZeroZx ca32fc1000 fix(service-worker): Preserves HTTP cache mode in asset group requests
Ensures explicit HTTP cache mode from incoming requests is forwarded and maintained when creating fetch requests for assets, aligning with expected fetch behavior and preventing unintended cache handling.

(cherry picked from commit 31399c2171)
2026-05-27 10:43:19 -07:00
SkyZeroZx b8bd49341d fix(service-worker): Preserves explicit 'credentials: omit' in asset requests
Ensures that explicitly provided `credentials: 'omit'` options are preserved
when creating new requests, preventing unintended credential inclusion.

(cherry picked from commit 5b0e9663e5)
2026-05-27 10:43:19 -07:00
leonsenft 251c8f2740 test(core): remove obsolete SVG script sanitization translation test (#68925)
Removes the `should throw error on translated SVG script ResourceURL
attributes` integration test from `security_integration_spec.ts`.

This test is now obsolete because SVG `<script>` elements are stripped during
template compilation (implemented in 90494cd909). As a result, they are no
longer present in the compiled template to trigger runtime sanitization,
causing this test (which expected a sanitization error to be thrown) to fail.

PR Close #68925
2026-05-27 10:42:29 -07:00
Alan Agius dada86e43d fix(core): synchronize core sanitization schema with compiler (#68925)
Synchronizes the core's copy of the DOM security schema with the compiler-side schema definitions.

PR Close #68925
2026-05-27 10:42:29 -07:00
Alan Agius 782e01594e fix(compiler): strip namespaced SVG script elements during template compilation (#68925)
Ensures that namespaced <script> elements (such as :svg:script) are correctly classified as PreparsedElementType.SCRIPT by the template preparser and stripped during compilation to prevent potential XSS vulnerabilities. Consequently, obsolete security schema mappings and runtime sanitization checks for <script> attributes have been removed since these elements are never present in compiled template outputs.

PR Close #68925
2026-05-27 10:42:29 -07:00
Alan Agius ff12fe55ac fix(core): normalize tag names in runtime i18n attribute security context lookup (#68925)
Normalize namespaced tag names (e.g., :xhtml:a to a) inside i18nResolveSanitizer before looking up their security context. This ensures custom namespaced tag attributes undergo correct translation sanitization at runtime.

PR Close #68925
2026-05-27 10:42:29 -07:00
Alan Agius 0b07f47bd6 fix(compiler): normalize tag names with custom namespaces in DomElementSchemaRegistry (#68925)
Custom XML/XHTML namespaced elements (e.g., <xhtml:a>) fall back to the standard HTML namespace during element creation at compile-time/runtime. However, their property and security context lookups inside the schema registry were incorrectly performed using the full namespaced tag name (e.g., :xhtml:a), which bypassed the default a|href sanitization registry and incorrectly returned SecurityContext.NONE instead of SecurityContext.URL.

This commit introduces tag name normalization inside DomElementSchemaRegistry for custom namespaces (other than the built-in svg and math namespaces). Custom namespaced tag names are now normalized to their simple HTML element counterparts for all registry queries, ensuring that correct property schema validation and dynamic security sanitization rules (such as URL sanitization) are enforced at runtime.

PR Close #68925
2026-05-27 10:42:29 -07:00
Alan Agius cc1378d54b fix(compiler): sanitize dynamic href and xlink:href bindings on SVG a elements (#68925)
Dynamic bindings to `href` and `xlink:href` attributes on SVG `<a>` elements (`<svg:a>`) were previously unmapped in the DOM security schema. As a result, they bypassed sanitization completely, creating a potential XSS vulnerability if bound to untrusted user inputs (e.g., `javascript:` URLs).

This fix mitigates this risk by:

1. Registering `href` and `xlink:href` on `<svg:a>` elements under the `SecurityContext.URL` context in both the compiler and core DOM security schemas.

2. Enabling template compilation to output runtime URL sanitization checks (`ɵɵsanitizeUrl`) on these attributes.

3. Adding regression and verification test cases to ensure dynamic SVG link bindings are safely sanitized at runtime while static values are correctly allowed.

PR Close #68925
2026-05-27 10:42:29 -07:00
Alan Agius daaf32937f fix(core): support prefix-insensitive DOM schema lookups and compile-time i18n attribute validation (#68925)
Updates `DomElementSchemaRegistry` to strip `:svg:` and `:math:` namespace prefixes
from tag names before querying `SECURITY_SCHEMA` at compile-time. This allows SVG
and MathML attributes to correctly match their security contexts during compilation.

PR Close #68925
2026-05-27 10:42:29 -07:00
Matthieu Riegler 37e8aadf87 fix(platform-server): prevent SSRF bypasses via backslash URLs in HttpClient
Encoding backslashes ensures that they are not normalized to slashes and where they could generate a protocol relative URL.

(cherry picked from commit 140c4d04cb)
2026-05-27 10:23:34 -07:00
Alan Agius 72696e244e fix(platform-server): secure location and document initialization against SSRF and path hijack
Normalizes the URL and path parsing logic inside platform-server by consolidating security checks and normalizations into a single, unified parseUrl helper function.

This includes:
- Collapsing multiple consecutive leading slashes and backslashes (e.g., // or /\) to a single forward slash to avoid protocol-relative parsing of path-like & relative inputs.
- Rejecting malformed absolute URLs that are otherwise accepted by lenient DOM parsers like Domino but rejected by standard WHATWG parsers, preventing SSRF / allowedHosts validation bypasses.
- Ensuring parseDocument gets the fully parsed and normalized URL instead of raw, unvalidated configuration values, preventing virtual document hostname adoption/origin hijack.
- Moving parseUrl unit tests into a dedicated url_spec.ts test file to keep platform_location_spec.ts clean and decoupled.

(cherry picked from commit 1307ff355c)
2026-05-27 10:22:42 -07:00
Matthieu Riegler 300f61feb3 fix(common): sanitize placeholder
The placeholder should be sanitized to prevent CSS/content injection.

(cherry picked from commit b56e865148)
2026-05-27 10:21:55 -07:00
Matthieu Riegler 7f4ac78994 fix(common): add upper bounds for digitsInfo
The prevents the `roundNumber` function from allocating a large array.

(cherry picked from commit dfdfbe34a5)
2026-05-27 10:21:02 -07:00
Matthieu Riegler e6fe77cc97 fix(core): sanitize meta selectors
Ensure that property/name are correctly escaped and doesn't break out of the intended selector.

(cherry picked from commit d5a489aed3)
2026-05-27 10:19:01 -07:00