@angular/compiler 20.3.14 → 20.3.16

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.16
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',
@@ -20378,6 +20447,33 @@ function SECURITY_SCHEMA() {
20378
20447
  'object|codebase',
20379
20448
  'object|data',
20380
20449
  'script|src',
20450
+ // The below two are for Script SVG
20451
+ // See: https://developer.mozilla.org/en-US/docs/Web/API/SVGScriptElement/href
20452
+ 'script|href',
20453
+ 'script|xlink:href',
20454
+ ]);
20455
+ // Keep this in sync with SECURITY_SENSITIVE_ELEMENTS in packages/core/src/sanitization/sanitization.ts
20456
+ // Unknown is the internal tag name for unknown elements example used for host-bindings.
20457
+ // These are unsafe as `attributeName` can be `href` or `xlink:href`
20458
+ // See: http://b/463880509#comment7
20459
+ registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, [
20460
+ 'animate|attributeName',
20461
+ 'set|attributeName',
20462
+ 'animateMotion|attributeName',
20463
+ 'animateTransform|attributeName',
20464
+ 'unknown|attributeName',
20465
+ 'iframe|sandbox',
20466
+ 'iframe|allow',
20467
+ 'iframe|allowFullscreen',
20468
+ 'iframe|referrerPolicy',
20469
+ 'iframe|csp',
20470
+ 'iframe|fetchPriority',
20471
+ 'unknown|sandbox',
20472
+ 'unknown|allow',
20473
+ 'unknown|allowFullscreen',
20474
+ 'unknown|referrerPolicy',
20475
+ 'unknown|csp',
20476
+ 'unknown|fetchPriority',
20381
20477
  ]);
20382
20478
  }
20383
20479
  return _SECURITY_SCHEMA;
@@ -20386,32 +20482,6 @@ function registerContext(ctx, specs) {
20386
20482
  for (const spec of specs)
20387
20483
  _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
20388
20484
  }
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
20485
 
20416
20486
  class ElementSchemaRegistry {
20417
20487
  }
@@ -25194,6 +25264,7 @@ const sanitizerFns = new Map([
25194
25264
  [SecurityContext.SCRIPT, Identifiers.sanitizeScript],
25195
25265
  [SecurityContext.STYLE, Identifiers.sanitizeStyle],
25196
25266
  [SecurityContext.URL, Identifiers.sanitizeUrl],
25267
+ [SecurityContext.ATTRIBUTE_NO_BINDING, Identifiers.validateAttribute],
25197
25268
  ]);
25198
25269
  /**
25199
25270
  * Map of security contexts to their trusted value function.
@@ -25207,7 +25278,6 @@ const trustedValueFns = new Map([
25207
25278
  */
25208
25279
  function resolveSanitizers(job) {
25209
25280
  for (const unit of job.units) {
25210
- const elements = createOpXrefMap(unit);
25211
25281
  // For normal element bindings we create trusted values for security sensitive constant
25212
25282
  // attributes. However, for host bindings we skip this step (this matches what
25213
25283
  // TemplateDefinitionBuilder does).
@@ -25228,8 +25298,8 @@ function resolveSanitizers(job) {
25228
25298
  let sanitizerFn = null;
25229
25299
  if (Array.isArray(op.securityContext) &&
25230
25300
  op.securityContext.length === 2 &&
25231
- op.securityContext.indexOf(SecurityContext.URL) > -1 &&
25232
- op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
25301
+ op.securityContext.includes(SecurityContext.URL) &&
25302
+ op.securityContext.includes(SecurityContext.RESOURCE_URL)) {
25233
25303
  // When the host element isn't known, some URL attributes (such as "src" and "href") may
25234
25304
  // be part of multiple different security contexts. In this case we use special
25235
25305
  // sanitization function and select the actual sanitizer at runtime based on a tag name
@@ -25240,43 +25310,11 @@ function resolveSanitizers(job) {
25240
25310
  sanitizerFn = sanitizerFns.get(getOnlySecurityContext(op.securityContext)) ?? null;
25241
25311
  }
25242
25312
  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
25313
  break;
25270
25314
  }
25271
25315
  }
25272
25316
  }
25273
25317
  }
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
25318
  /**
25281
25319
  * Asserts that there is only a single security context and returns it.
25282
25320
  */
@@ -34277,7 +34315,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34277
34315
  function compileDeclareClassMetadata(metadata) {
34278
34316
  const definitionMap = new DefinitionMap();
34279
34317
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34280
- definitionMap.set('version', literal('20.3.14'));
34318
+ definitionMap.set('version', literal('20.3.16'));
34281
34319
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34282
34320
  definitionMap.set('type', metadata.type);
34283
34321
  definitionMap.set('decorators', metadata.decorators);
@@ -34295,7 +34333,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34295
34333
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34296
34334
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34297
34335
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34298
- definitionMap.set('version', literal('20.3.14'));
34336
+ definitionMap.set('version', literal('20.3.16'));
34299
34337
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34300
34338
  definitionMap.set('type', metadata.type);
34301
34339
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34390,7 +34428,7 @@ function createDirectiveDefinitionMap(meta) {
34390
34428
  const definitionMap = new DefinitionMap();
34391
34429
  const minVersion = getMinimumVersionForPartialOutput(meta);
34392
34430
  definitionMap.set('minVersion', literal(minVersion));
34393
- definitionMap.set('version', literal('20.3.14'));
34431
+ definitionMap.set('version', literal('20.3.16'));
34394
34432
  // e.g. `type: MyDirective`
34395
34433
  definitionMap.set('type', meta.type.value);
34396
34434
  if (meta.isStandalone !== undefined) {
@@ -34806,7 +34844,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34806
34844
  function compileDeclareFactoryFunction(meta) {
34807
34845
  const definitionMap = new DefinitionMap();
34808
34846
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34809
- definitionMap.set('version', literal('20.3.14'));
34847
+ definitionMap.set('version', literal('20.3.16'));
34810
34848
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34811
34849
  definitionMap.set('type', meta.type.value);
34812
34850
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34841,7 +34879,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34841
34879
  function createInjectableDefinitionMap(meta) {
34842
34880
  const definitionMap = new DefinitionMap();
34843
34881
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34844
- definitionMap.set('version', literal('20.3.14'));
34882
+ definitionMap.set('version', literal('20.3.16'));
34845
34883
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34846
34884
  definitionMap.set('type', meta.type.value);
34847
34885
  // Only generate providedIn property if it has a non-null value
@@ -34892,7 +34930,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34892
34930
  function createInjectorDefinitionMap(meta) {
34893
34931
  const definitionMap = new DefinitionMap();
34894
34932
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34895
- definitionMap.set('version', literal('20.3.14'));
34933
+ definitionMap.set('version', literal('20.3.16'));
34896
34934
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34897
34935
  definitionMap.set('type', meta.type.value);
34898
34936
  definitionMap.set('providers', meta.providers);
@@ -34925,7 +34963,7 @@ function createNgModuleDefinitionMap(meta) {
34925
34963
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34926
34964
  }
34927
34965
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34928
- definitionMap.set('version', literal('20.3.14'));
34966
+ definitionMap.set('version', literal('20.3.16'));
34929
34967
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34930
34968
  definitionMap.set('type', meta.type.value);
34931
34969
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34976,7 +35014,7 @@ function compileDeclarePipeFromMetadata(meta) {
34976
35014
  function createPipeDefinitionMap(meta) {
34977
35015
  const definitionMap = new DefinitionMap();
34978
35016
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34979
- definitionMap.set('version', literal('20.3.14'));
35017
+ definitionMap.set('version', literal('20.3.16'));
34980
35018
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34981
35019
  // e.g. `type: MyPipe`
34982
35020
  definitionMap.set('type', meta.type.value);
@@ -35132,7 +35170,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35132
35170
  * @description
35133
35171
  * Entry point for all public APIs of the compiler package.
35134
35172
  */
35135
- const VERSION = new Version('20.3.14');
35173
+ const VERSION = new Version('20.3.16');
35136
35174
 
35137
35175
  //////////////////////////////////////
35138
35176
  // THIS FILE HAS GLOBAL SIDE EFFECT //