@angular/compiler 20.3.14 → 20.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.14
2
+ * @license Angular v20.3.15
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -449,6 +449,7 @@ var SecurityContext;
449
449
  SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
450
450
  SecurityContext[SecurityContext["URL"] = 4] = "URL";
451
451
  SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
452
+ SecurityContext[SecurityContext["ATTRIBUTE_NO_BINDING"] = 6] = "ATTRIBUTE_NO_BINDING";
452
453
  })(SecurityContext || (SecurityContext = {}));
453
454
  var MissingTranslationStrategy;
454
455
  (function (MissingTranslationStrategy) {
@@ -2975,6 +2976,10 @@ class Identifiers {
2975
2976
  // sanitization-related functions
2976
2977
  static sanitizeHtml = { name: 'ɵɵsanitizeHtml', moduleName: CORE };
2977
2978
  static sanitizeStyle = { name: 'ɵɵsanitizeStyle', moduleName: CORE };
2979
+ static validateAttribute = {
2980
+ name: 'ɵɵvalidateAttribute',
2981
+ moduleName: CORE,
2982
+ };
2978
2983
  static sanitizeResourceUrl = {
2979
2984
  name: 'ɵɵsanitizeResourceUrl',
2980
2985
  moduleName: CORE,
@@ -2990,10 +2995,6 @@ class Identifiers {
2990
2995
  name: 'ɵɵtrustConstantResourceUrl',
2991
2996
  moduleName: CORE,
2992
2997
  };
2993
- static validateIframeAttribute = {
2994
- name: 'ɵɵvalidateIframeAttribute',
2995
- moduleName: CORE,
2996
- };
2997
2998
  // Decorators
2998
2999
  static inputDecorator = { name: 'Input', moduleName: CORE };
2999
3000
  static outputDecorator = { name: 'Output', moduleName: CORE };
@@ -20332,7 +20333,6 @@ function interleave(left, right) {
20332
20333
  // =================================================================================================
20333
20334
  //
20334
20335
  // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
20335
- // Reach out to mprobst for details.
20336
20336
  //
20337
20337
  // =================================================================================================
20338
20338
  /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
@@ -20350,6 +20350,7 @@ function SECURITY_SCHEMA() {
20350
20350
  'area|ping',
20351
20351
  'audio|src',
20352
20352
  'a|href',
20353
+ 'a|xlink:href',
20353
20354
  'a|ping',
20354
20355
  'blockquote|cite',
20355
20356
  'body|background',
@@ -20363,6 +20364,74 @@ function SECURITY_SCHEMA() {
20363
20364
  'track|src',
20364
20365
  'video|poster',
20365
20366
  'video|src',
20367
+ // MathML namespace
20368
+ // https://crsrc.org/c/third_party/blink/renderer/core/sanitizer/sanitizer.cc;l=753-768;drc=b3eb16372dcd3317d65e9e0265015e322494edcd;bpv=1;bpt=1
20369
+ 'annotation|href',
20370
+ 'annotation|xlink:href',
20371
+ 'annotation-xml|href',
20372
+ 'annotation-xml|xlink:href',
20373
+ 'maction|href',
20374
+ 'maction|xlink:href',
20375
+ 'malignmark|href',
20376
+ 'malignmark|xlink:href',
20377
+ 'math|href',
20378
+ 'math|xlink:href',
20379
+ 'mroot|href',
20380
+ 'mroot|xlink:href',
20381
+ 'msqrt|href',
20382
+ 'msqrt|xlink:href',
20383
+ 'merror|href',
20384
+ 'merror|xlink:href',
20385
+ 'mfrac|href',
20386
+ 'mfrac|xlink:href',
20387
+ 'mglyph|href',
20388
+ 'mglyph|xlink:href',
20389
+ 'msub|href',
20390
+ 'msub|xlink:href',
20391
+ 'msup|href',
20392
+ 'msup|xlink:href',
20393
+ 'msubsup|href',
20394
+ 'msubsup|xlink:href',
20395
+ 'mmultiscripts|href',
20396
+ 'mmultiscripts|xlink:href',
20397
+ 'mprescripts|href',
20398
+ 'mprescripts|xlink:href',
20399
+ 'mi|href',
20400
+ 'mi|xlink:href',
20401
+ 'mn|href',
20402
+ 'mn|xlink:href',
20403
+ 'mo|href',
20404
+ 'mo|xlink:href',
20405
+ 'mpadded|href',
20406
+ 'mpadded|xlink:href',
20407
+ 'mphantom|href',
20408
+ 'mphantom|xlink:href',
20409
+ 'mrow|href',
20410
+ 'mrow|xlink:href',
20411
+ 'ms|href',
20412
+ 'ms|xlink:href',
20413
+ 'mspace|href',
20414
+ 'mspace|xlink:href',
20415
+ 'mstyle|href',
20416
+ 'mstyle|xlink:href',
20417
+ 'mtable|href',
20418
+ 'mtable|xlink:href',
20419
+ 'mtd|href',
20420
+ 'mtd|xlink:href',
20421
+ 'mtr|href',
20422
+ 'mtr|xlink:href',
20423
+ 'mtext|href',
20424
+ 'mtext|xlink:href',
20425
+ 'mover|href',
20426
+ 'mover|xlink:href',
20427
+ 'munder|href',
20428
+ 'munder|xlink:href',
20429
+ 'munderover|href',
20430
+ 'munderover|xlink:href',
20431
+ 'semantics|href',
20432
+ 'semantics|xlink:href',
20433
+ 'none|href',
20434
+ 'none|xlink:href',
20366
20435
  ]);
20367
20436
  registerContext(SecurityContext.RESOURCE_URL, [
20368
20437
  'applet|code',
@@ -20379,6 +20448,29 @@ function SECURITY_SCHEMA() {
20379
20448
  'object|data',
20380
20449
  'script|src',
20381
20450
  ]);
20451
+ // Keep this in sync with SECURITY_SENSITIVE_ELEMENTS in packages/core/src/sanitization/sanitization.ts
20452
+ // Unknown is the internal tag name for unknown elements example used for host-bindings.
20453
+ // These are unsafe as `attributeName` can be `href` or `xlink:href`
20454
+ // See: http://b/463880509#comment7
20455
+ registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, [
20456
+ 'animate|attributeName',
20457
+ 'set|attributeName',
20458
+ 'animateMotion|attributeName',
20459
+ 'animateTransform|attributeName',
20460
+ 'unknown|attributeName',
20461
+ 'iframe|sandbox',
20462
+ 'iframe|allow',
20463
+ 'iframe|allowFullscreen',
20464
+ 'iframe|referrerPolicy',
20465
+ 'iframe|csp',
20466
+ 'iframe|fetchPriority',
20467
+ 'unknown|sandbox',
20468
+ 'unknown|allow',
20469
+ 'unknown|allowFullscreen',
20470
+ 'unknown|referrerPolicy',
20471
+ 'unknown|csp',
20472
+ 'unknown|fetchPriority',
20473
+ ]);
20382
20474
  }
20383
20475
  return _SECURITY_SCHEMA;
20384
20476
  }
@@ -20386,32 +20478,6 @@ function registerContext(ctx, specs) {
20386
20478
  for (const spec of specs)
20387
20479
  _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
20388
20480
  }
20389
- /**
20390
- * The set of security-sensitive attributes of an `<iframe>` that *must* be
20391
- * applied as a static attribute only. This ensures that all security-sensitive
20392
- * attributes are taken into account while creating an instance of an `<iframe>`
20393
- * at runtime.
20394
- *
20395
- * Note: avoid using this set directly, use the `isIframeSecuritySensitiveAttr` function
20396
- * in the code instead.
20397
- */
20398
- const IFRAME_SECURITY_SENSITIVE_ATTRS = new Set([
20399
- 'sandbox',
20400
- 'allow',
20401
- 'allowfullscreen',
20402
- 'referrerpolicy',
20403
- 'csp',
20404
- 'fetchpriority',
20405
- ]);
20406
- /**
20407
- * Checks whether a given attribute name might represent a security-sensitive
20408
- * attribute of an <iframe>.
20409
- */
20410
- function isIframeSecuritySensitiveAttr(attrName) {
20411
- // The `setAttribute` DOM API is case-insensitive, so we lowercase the value
20412
- // before checking it against a known security-sensitive attributes.
20413
- return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
20414
- }
20415
20481
 
20416
20482
  class ElementSchemaRegistry {
20417
20483
  }
@@ -25194,6 +25260,7 @@ const sanitizerFns = new Map([
25194
25260
  [SecurityContext.SCRIPT, Identifiers.sanitizeScript],
25195
25261
  [SecurityContext.STYLE, Identifiers.sanitizeStyle],
25196
25262
  [SecurityContext.URL, Identifiers.sanitizeUrl],
25263
+ [SecurityContext.ATTRIBUTE_NO_BINDING, Identifiers.validateAttribute],
25197
25264
  ]);
25198
25265
  /**
25199
25266
  * Map of security contexts to their trusted value function.
@@ -25207,7 +25274,6 @@ const trustedValueFns = new Map([
25207
25274
  */
25208
25275
  function resolveSanitizers(job) {
25209
25276
  for (const unit of job.units) {
25210
- const elements = createOpXrefMap(unit);
25211
25277
  // For normal element bindings we create trusted values for security sensitive constant
25212
25278
  // attributes. However, for host bindings we skip this step (this matches what
25213
25279
  // TemplateDefinitionBuilder does).
@@ -25228,8 +25294,8 @@ function resolveSanitizers(job) {
25228
25294
  let sanitizerFn = null;
25229
25295
  if (Array.isArray(op.securityContext) &&
25230
25296
  op.securityContext.length === 2 &&
25231
- op.securityContext.indexOf(SecurityContext.URL) > -1 &&
25232
- op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
25297
+ op.securityContext.includes(SecurityContext.URL) &&
25298
+ op.securityContext.includes(SecurityContext.RESOURCE_URL)) {
25233
25299
  // When the host element isn't known, some URL attributes (such as "src" and "href") may
25234
25300
  // be part of multiple different security contexts. In this case we use special
25235
25301
  // sanitization function and select the actual sanitizer at runtime based on a tag name
@@ -25240,43 +25306,11 @@ function resolveSanitizers(job) {
25240
25306
  sanitizerFn = sanitizerFns.get(getOnlySecurityContext(op.securityContext)) ?? null;
25241
25307
  }
25242
25308
  op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
25243
- // If there was no sanitization function found based on the security context of an
25244
- // attribute/property, check whether this attribute/property is one of the
25245
- // security-sensitive <iframe> attributes (and that the current element is actually an
25246
- // <iframe>).
25247
- if (op.sanitizer === null) {
25248
- let isIframe = false;
25249
- if (job.kind === CompilationJobKind.Host || op.kind === OpKind.DomProperty) {
25250
- // Note: for host bindings defined on a directive, we do not try to find all
25251
- // possible places where it can be matched, so we can not determine whether
25252
- // the host element is an <iframe>. In this case, we just assume it is and append a
25253
- // validation function, which is invoked at runtime and would have access to the
25254
- // underlying DOM element to check if it's an <iframe> and if so - run extra checks.
25255
- isIframe = true;
25256
- }
25257
- else {
25258
- // For a normal binding we can just check if the element its on is an iframe.
25259
- const ownerOp = elements.get(op.target);
25260
- if (ownerOp === undefined || !isElementOrContainerOp(ownerOp)) {
25261
- throw Error('Property should have an element-like owner');
25262
- }
25263
- isIframe = isIframeElement(ownerOp);
25264
- }
25265
- if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
25266
- op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
25267
- }
25268
- }
25269
25309
  break;
25270
25310
  }
25271
25311
  }
25272
25312
  }
25273
25313
  }
25274
- /**
25275
- * Checks whether the given op represents an iframe element.
25276
- */
25277
- function isIframeElement(op) {
25278
- return op.kind === OpKind.ElementStart && op.tag?.toLowerCase() === 'iframe';
25279
- }
25280
25314
  /**
25281
25315
  * Asserts that there is only a single security context and returns it.
25282
25316
  */
@@ -34277,7 +34311,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34277
34311
  function compileDeclareClassMetadata(metadata) {
34278
34312
  const definitionMap = new DefinitionMap();
34279
34313
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34280
- definitionMap.set('version', literal('20.3.14'));
34314
+ definitionMap.set('version', literal('20.3.15'));
34281
34315
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34282
34316
  definitionMap.set('type', metadata.type);
34283
34317
  definitionMap.set('decorators', metadata.decorators);
@@ -34295,7 +34329,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34295
34329
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34296
34330
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34297
34331
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34298
- definitionMap.set('version', literal('20.3.14'));
34332
+ definitionMap.set('version', literal('20.3.15'));
34299
34333
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34300
34334
  definitionMap.set('type', metadata.type);
34301
34335
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34390,7 +34424,7 @@ function createDirectiveDefinitionMap(meta) {
34390
34424
  const definitionMap = new DefinitionMap();
34391
34425
  const minVersion = getMinimumVersionForPartialOutput(meta);
34392
34426
  definitionMap.set('minVersion', literal(minVersion));
34393
- definitionMap.set('version', literal('20.3.14'));
34427
+ definitionMap.set('version', literal('20.3.15'));
34394
34428
  // e.g. `type: MyDirective`
34395
34429
  definitionMap.set('type', meta.type.value);
34396
34430
  if (meta.isStandalone !== undefined) {
@@ -34806,7 +34840,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34806
34840
  function compileDeclareFactoryFunction(meta) {
34807
34841
  const definitionMap = new DefinitionMap();
34808
34842
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34809
- definitionMap.set('version', literal('20.3.14'));
34843
+ definitionMap.set('version', literal('20.3.15'));
34810
34844
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34811
34845
  definitionMap.set('type', meta.type.value);
34812
34846
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34841,7 +34875,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34841
34875
  function createInjectableDefinitionMap(meta) {
34842
34876
  const definitionMap = new DefinitionMap();
34843
34877
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34844
- definitionMap.set('version', literal('20.3.14'));
34878
+ definitionMap.set('version', literal('20.3.15'));
34845
34879
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34846
34880
  definitionMap.set('type', meta.type.value);
34847
34881
  // Only generate providedIn property if it has a non-null value
@@ -34892,7 +34926,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34892
34926
  function createInjectorDefinitionMap(meta) {
34893
34927
  const definitionMap = new DefinitionMap();
34894
34928
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34895
- definitionMap.set('version', literal('20.3.14'));
34929
+ definitionMap.set('version', literal('20.3.15'));
34896
34930
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34897
34931
  definitionMap.set('type', meta.type.value);
34898
34932
  definitionMap.set('providers', meta.providers);
@@ -34925,7 +34959,7 @@ function createNgModuleDefinitionMap(meta) {
34925
34959
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34926
34960
  }
34927
34961
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34928
- definitionMap.set('version', literal('20.3.14'));
34962
+ definitionMap.set('version', literal('20.3.15'));
34929
34963
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34930
34964
  definitionMap.set('type', meta.type.value);
34931
34965
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34976,7 +35010,7 @@ function compileDeclarePipeFromMetadata(meta) {
34976
35010
  function createPipeDefinitionMap(meta) {
34977
35011
  const definitionMap = new DefinitionMap();
34978
35012
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34979
- definitionMap.set('version', literal('20.3.14'));
35013
+ definitionMap.set('version', literal('20.3.15'));
34980
35014
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34981
35015
  // e.g. `type: MyPipe`
34982
35016
  definitionMap.set('type', meta.type.value);
@@ -35132,7 +35166,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35132
35166
  * @description
35133
35167
  * Entry point for all public APIs of the compiler package.
35134
35168
  */
35135
- const VERSION = new Version('20.3.14');
35169
+ const VERSION = new Version('20.3.15');
35136
35170
 
35137
35171
  //////////////////////////////////////
35138
35172
  // THIS FILE HAS GLOBAL SIDE EFFECT //