@angular/compiler 14.2.11 → 14.3.0

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 v14.2.11
2
+ * @license Angular v14.3.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.2.11
2
+ * @license Angular v14.3.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2936,6 +2936,7 @@ Identifiers.sanitizeUrl = { name: 'ɵɵsanitizeUrl', moduleName: CORE };
2936
2936
  Identifiers.sanitizeUrlOrResourceUrl = { name: 'ɵɵsanitizeUrlOrResourceUrl', moduleName: CORE };
2937
2937
  Identifiers.trustConstantHtml = { name: 'ɵɵtrustConstantHtml', moduleName: CORE };
2938
2938
  Identifiers.trustConstantResourceUrl = { name: 'ɵɵtrustConstantResourceUrl', moduleName: CORE };
2939
+ Identifiers.validateIframeAttribute = { name: 'ɵɵvalidateIframeAttribute', moduleName: CORE };
2939
2940
 
2940
2941
  /**
2941
2942
  * @license
@@ -7682,6 +7683,98 @@ class BuiltinFunctionCall extends Call {
7682
7683
  }
7683
7684
  }
7684
7685
 
7686
+ /**
7687
+ * @license
7688
+ * Copyright Google LLC All Rights Reserved.
7689
+ *
7690
+ * Use of this source code is governed by an MIT-style license that can be
7691
+ * found in the LICENSE file at https://angular.io/license
7692
+ */
7693
+ // =================================================================================================
7694
+ // =================================================================================================
7695
+ // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
7696
+ // =================================================================================================
7697
+ // =================================================================================================
7698
+ //
7699
+ // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
7700
+ // Reach out to mprobst for details.
7701
+ //
7702
+ // =================================================================================================
7703
+ /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
7704
+ let _SECURITY_SCHEMA;
7705
+ function SECURITY_SCHEMA() {
7706
+ if (!_SECURITY_SCHEMA) {
7707
+ _SECURITY_SCHEMA = {};
7708
+ // Case is insignificant below, all element and attribute names are lower-cased for lookup.
7709
+ registerContext(SecurityContext.HTML, [
7710
+ 'iframe|srcdoc',
7711
+ '*|innerHTML',
7712
+ '*|outerHTML',
7713
+ ]);
7714
+ registerContext(SecurityContext.STYLE, ['*|style']);
7715
+ // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
7716
+ registerContext(SecurityContext.URL, [
7717
+ '*|formAction',
7718
+ 'area|href',
7719
+ 'area|ping',
7720
+ 'audio|src',
7721
+ 'a|href',
7722
+ 'a|ping',
7723
+ 'blockquote|cite',
7724
+ 'body|background',
7725
+ 'del|cite',
7726
+ 'form|action',
7727
+ 'img|src',
7728
+ 'input|src',
7729
+ 'ins|cite',
7730
+ 'q|cite',
7731
+ 'source|src',
7732
+ 'track|src',
7733
+ 'video|poster',
7734
+ 'video|src',
7735
+ ]);
7736
+ registerContext(SecurityContext.RESOURCE_URL, [
7737
+ 'applet|code',
7738
+ 'applet|codebase',
7739
+ 'base|href',
7740
+ 'embed|src',
7741
+ 'frame|src',
7742
+ 'head|profile',
7743
+ 'html|manifest',
7744
+ 'iframe|src',
7745
+ 'link|href',
7746
+ 'media|src',
7747
+ 'object|codebase',
7748
+ 'object|data',
7749
+ 'script|src',
7750
+ ]);
7751
+ }
7752
+ return _SECURITY_SCHEMA;
7753
+ }
7754
+ function registerContext(ctx, specs) {
7755
+ for (const spec of specs)
7756
+ _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
7757
+ }
7758
+ /**
7759
+ * The set of security-sensitive attributes of an `<iframe>` that *must* be
7760
+ * applied as a static attribute only. This ensures that all security-sensitive
7761
+ * attributes are taken into account while creating an instance of an `<iframe>`
7762
+ * at runtime.
7763
+ *
7764
+ * Note: avoid using this set directly, use the `isIframeSecuritySensitiveAttr` function
7765
+ * in the code instead.
7766
+ */
7767
+ const IFRAME_SECURITY_SENSITIVE_ATTRS = new Set(['sandbox', 'allow', 'allowfullscreen', 'referrerpolicy', 'csp', 'fetchpriority']);
7768
+ /**
7769
+ * Checks whether a given attribute name might represent a security-sensitive
7770
+ * attribute of an <iframe>.
7771
+ */
7772
+ function isIframeSecuritySensitiveAttr(attrName) {
7773
+ // The `setAttribute` DOM API is case-insensitive, so we lowercase the value
7774
+ // before checking it against a known security-sensitive attributes.
7775
+ return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
7776
+ }
7777
+
7685
7778
  /**
7686
7779
  * @license
7687
7780
  * Copyright Google LLC All Rights Reserved.
@@ -14494,79 +14587,6 @@ function mapLiteral(obj, quoted = false) {
14494
14587
  })));
14495
14588
  }
14496
14589
 
14497
- /**
14498
- * @license
14499
- * Copyright Google LLC All Rights Reserved.
14500
- *
14501
- * Use of this source code is governed by an MIT-style license that can be
14502
- * found in the LICENSE file at https://angular.io/license
14503
- */
14504
- // =================================================================================================
14505
- // =================================================================================================
14506
- // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
14507
- // =================================================================================================
14508
- // =================================================================================================
14509
- //
14510
- // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
14511
- // Reach out to mprobst for details.
14512
- //
14513
- // =================================================================================================
14514
- /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
14515
- let _SECURITY_SCHEMA;
14516
- function SECURITY_SCHEMA() {
14517
- if (!_SECURITY_SCHEMA) {
14518
- _SECURITY_SCHEMA = {};
14519
- // Case is insignificant below, all element and attribute names are lower-cased for lookup.
14520
- registerContext(SecurityContext.HTML, [
14521
- 'iframe|srcdoc',
14522
- '*|innerHTML',
14523
- '*|outerHTML',
14524
- ]);
14525
- registerContext(SecurityContext.STYLE, ['*|style']);
14526
- // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
14527
- registerContext(SecurityContext.URL, [
14528
- '*|formAction',
14529
- 'area|href',
14530
- 'area|ping',
14531
- 'audio|src',
14532
- 'a|href',
14533
- 'a|ping',
14534
- 'blockquote|cite',
14535
- 'body|background',
14536
- 'del|cite',
14537
- 'form|action',
14538
- 'img|src',
14539
- 'input|src',
14540
- 'ins|cite',
14541
- 'q|cite',
14542
- 'source|src',
14543
- 'track|src',
14544
- 'video|poster',
14545
- 'video|src',
14546
- ]);
14547
- registerContext(SecurityContext.RESOURCE_URL, [
14548
- 'applet|code',
14549
- 'applet|codebase',
14550
- 'base|href',
14551
- 'embed|src',
14552
- 'frame|src',
14553
- 'head|profile',
14554
- 'html|manifest',
14555
- 'iframe|src',
14556
- 'link|href',
14557
- 'media|src',
14558
- 'object|codebase',
14559
- 'object|data',
14560
- 'script|src',
14561
- ]);
14562
- }
14563
- return _SECURITY_SCHEMA;
14564
- }
14565
- function registerContext(ctx, specs) {
14566
- for (const spec of specs)
14567
- _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
14568
- }
14569
-
14570
14590
  /**
14571
14591
  * @license
14572
14592
  * Copyright Google LLC All Rights Reserved.
@@ -17630,9 +17650,19 @@ class TemplateDefinitionBuilder {
17630
17650
  const params = [];
17631
17651
  const [attrNamespace, attrName] = splitNsName(input.name);
17632
17652
  const isAttributeBinding = inputType === 1 /* BindingType.Attribute */;
17633
- const sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
17634
- if (sanitizationRef)
17653
+ let sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
17654
+ if (!sanitizationRef) {
17655
+ // If there was no sanitization function found based on the security context
17656
+ // of an attribute/property - check whether this attribute/property is
17657
+ // one of the security-sensitive <iframe> attributes (and that the current
17658
+ // element is actually an <iframe>).
17659
+ if (isIframeElement(element.name) && isIframeSecuritySensitiveAttr(input.name)) {
17660
+ sanitizationRef = importExpr(Identifiers.validateIframeAttribute);
17661
+ }
17662
+ }
17663
+ if (sanitizationRef) {
17635
17664
  params.push(sanitizationRef);
17665
+ }
17636
17666
  if (attrNamespace) {
17637
17667
  const namespaceLiteral = literal(attrNamespace);
17638
17668
  if (sanitizationRef) {
@@ -18697,6 +18727,9 @@ function isSingleElementTemplate(children) {
18697
18727
  function isTextNode(node) {
18698
18728
  return node instanceof Text$3 || node instanceof BoundText || node instanceof Icu$1;
18699
18729
  }
18730
+ function isIframeElement(tagName) {
18731
+ return tagName.toLowerCase() === 'iframe';
18732
+ }
18700
18733
  function hasTextChildrenOnly(children) {
18701
18734
  return children.every(isTextNode);
18702
18735
  }
@@ -19174,6 +19207,20 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
19174
19207
  if (sanitizerFn) {
19175
19208
  instructionParams.push(sanitizerFn);
19176
19209
  }
19210
+ else {
19211
+ // If there was no sanitization function found based on the security context
19212
+ // of an attribute/property binding - check whether this attribute/property is
19213
+ // one of the security-sensitive <iframe> attributes.
19214
+ // Note: for host bindings defined on a directive, we do not try to find all
19215
+ // possible places where it can be matched, so we can not determine whether
19216
+ // the host element is an <iframe>. In this case, if an attribute/binding
19217
+ // name is in the `IFRAME_SECURITY_SENSITIVE_ATTRS` set - append a validation
19218
+ // function, which would be invoked at runtime and would have access to the
19219
+ // underlying DOM element, check if it's an <iframe> and if so - runs extra checks.
19220
+ if (isIframeSecuritySensitiveAttr(bindingName)) {
19221
+ instructionParams.push(importExpr(Identifiers.validateIframeAttribute));
19222
+ }
19223
+ }
19177
19224
  updateVariables.push(...bindingExpr.stmts);
19178
19225
  if (instruction === Identifiers.hostProperty) {
19179
19226
  propertyBindings.push(instructionParams);
@@ -19918,7 +19965,7 @@ function publishFacade(global) {
19918
19965
  * Use of this source code is governed by an MIT-style license that can be
19919
19966
  * found in the LICENSE file at https://angular.io/license
19920
19967
  */
19921
- const VERSION = new Version('14.2.11');
19968
+ const VERSION = new Version('14.3.0');
19922
19969
 
19923
19970
  /**
19924
19971
  * @license
@@ -21951,7 +21998,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21951
21998
  function compileDeclareClassMetadata(metadata) {
21952
21999
  const definitionMap = new DefinitionMap();
21953
22000
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21954
- definitionMap.set('version', literal('14.2.11'));
22001
+ definitionMap.set('version', literal('14.3.0'));
21955
22002
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21956
22003
  definitionMap.set('type', metadata.type);
21957
22004
  definitionMap.set('decorators', metadata.decorators);
@@ -22068,7 +22115,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
22068
22115
  function createDirectiveDefinitionMap(meta) {
22069
22116
  const definitionMap = new DefinitionMap();
22070
22117
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
22071
- definitionMap.set('version', literal('14.2.11'));
22118
+ definitionMap.set('version', literal('14.3.0'));
22072
22119
  // e.g. `type: MyDirective`
22073
22120
  definitionMap.set('type', meta.internalType);
22074
22121
  if (meta.isStandalone) {
@@ -22282,7 +22329,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22282
22329
  function compileDeclareFactoryFunction(meta) {
22283
22330
  const definitionMap = new DefinitionMap();
22284
22331
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22285
- definitionMap.set('version', literal('14.2.11'));
22332
+ definitionMap.set('version', literal('14.3.0'));
22286
22333
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22287
22334
  definitionMap.set('type', meta.internalType);
22288
22335
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22324,7 +22371,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22324
22371
  function createInjectableDefinitionMap(meta) {
22325
22372
  const definitionMap = new DefinitionMap();
22326
22373
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22327
- definitionMap.set('version', literal('14.2.11'));
22374
+ definitionMap.set('version', literal('14.3.0'));
22328
22375
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22329
22376
  definitionMap.set('type', meta.internalType);
22330
22377
  // Only generate providedIn property if it has a non-null value
@@ -22382,7 +22429,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22382
22429
  function createInjectorDefinitionMap(meta) {
22383
22430
  const definitionMap = new DefinitionMap();
22384
22431
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22385
- definitionMap.set('version', literal('14.2.11'));
22432
+ definitionMap.set('version', literal('14.3.0'));
22386
22433
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22387
22434
  definitionMap.set('type', meta.internalType);
22388
22435
  definitionMap.set('providers', meta.providers);
@@ -22419,7 +22466,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22419
22466
  function createNgModuleDefinitionMap(meta) {
22420
22467
  const definitionMap = new DefinitionMap();
22421
22468
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22422
- definitionMap.set('version', literal('14.2.11'));
22469
+ definitionMap.set('version', literal('14.3.0'));
22423
22470
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22424
22471
  definitionMap.set('type', meta.internalType);
22425
22472
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22477,7 +22524,7 @@ function compileDeclarePipeFromMetadata(meta) {
22477
22524
  function createPipeDefinitionMap(meta) {
22478
22525
  const definitionMap = new DefinitionMap();
22479
22526
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22480
- definitionMap.set('version', literal('14.2.11'));
22527
+ definitionMap.set('version', literal('14.3.0'));
22481
22528
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22482
22529
  // e.g. `type: MyPipe`
22483
22530
  definitionMap.set('type', meta.internalType);