@angular/compiler 15.0.0-rc.2 → 15.0.0-rc.3

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 v15.0.0-rc.2
2
+ * @license Angular v15.0.0-rc.3
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 v15.0.0-rc.2
2
+ * @license Angular v15.0.0-rc.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2937,6 +2937,7 @@ Identifiers.sanitizeUrl = { name: 'ɵɵsanitizeUrl', moduleName: CORE };
2937
2937
  Identifiers.sanitizeUrlOrResourceUrl = { name: 'ɵɵsanitizeUrlOrResourceUrl', moduleName: CORE };
2938
2938
  Identifiers.trustConstantHtml = { name: 'ɵɵtrustConstantHtml', moduleName: CORE };
2939
2939
  Identifiers.trustConstantResourceUrl = { name: 'ɵɵtrustConstantResourceUrl', moduleName: CORE };
2940
+ Identifiers.validateIframeAttribute = { name: 'ɵɵvalidateIframeAttribute', moduleName: CORE };
2940
2941
 
2941
2942
  /**
2942
2943
  * @license
@@ -7683,6 +7684,98 @@ class BuiltinFunctionCall extends Call {
7683
7684
  }
7684
7685
  }
7685
7686
 
7687
+ /**
7688
+ * @license
7689
+ * Copyright Google LLC All Rights Reserved.
7690
+ *
7691
+ * Use of this source code is governed by an MIT-style license that can be
7692
+ * found in the LICENSE file at https://angular.io/license
7693
+ */
7694
+ // =================================================================================================
7695
+ // =================================================================================================
7696
+ // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
7697
+ // =================================================================================================
7698
+ // =================================================================================================
7699
+ //
7700
+ // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
7701
+ // Reach out to mprobst for details.
7702
+ //
7703
+ // =================================================================================================
7704
+ /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
7705
+ let _SECURITY_SCHEMA;
7706
+ function SECURITY_SCHEMA() {
7707
+ if (!_SECURITY_SCHEMA) {
7708
+ _SECURITY_SCHEMA = {};
7709
+ // Case is insignificant below, all element and attribute names are lower-cased for lookup.
7710
+ registerContext(SecurityContext.HTML, [
7711
+ 'iframe|srcdoc',
7712
+ '*|innerHTML',
7713
+ '*|outerHTML',
7714
+ ]);
7715
+ registerContext(SecurityContext.STYLE, ['*|style']);
7716
+ // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
7717
+ registerContext(SecurityContext.URL, [
7718
+ '*|formAction',
7719
+ 'area|href',
7720
+ 'area|ping',
7721
+ 'audio|src',
7722
+ 'a|href',
7723
+ 'a|ping',
7724
+ 'blockquote|cite',
7725
+ 'body|background',
7726
+ 'del|cite',
7727
+ 'form|action',
7728
+ 'img|src',
7729
+ 'input|src',
7730
+ 'ins|cite',
7731
+ 'q|cite',
7732
+ 'source|src',
7733
+ 'track|src',
7734
+ 'video|poster',
7735
+ 'video|src',
7736
+ ]);
7737
+ registerContext(SecurityContext.RESOURCE_URL, [
7738
+ 'applet|code',
7739
+ 'applet|codebase',
7740
+ 'base|href',
7741
+ 'embed|src',
7742
+ 'frame|src',
7743
+ 'head|profile',
7744
+ 'html|manifest',
7745
+ 'iframe|src',
7746
+ 'link|href',
7747
+ 'media|src',
7748
+ 'object|codebase',
7749
+ 'object|data',
7750
+ 'script|src',
7751
+ ]);
7752
+ }
7753
+ return _SECURITY_SCHEMA;
7754
+ }
7755
+ function registerContext(ctx, specs) {
7756
+ for (const spec of specs)
7757
+ _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
7758
+ }
7759
+ /**
7760
+ * The set of security-sensitive attributes of an `<iframe>` that *must* be
7761
+ * applied as a static attribute only. This ensures that all security-sensitive
7762
+ * attributes are taken into account while creating an instance of an `<iframe>`
7763
+ * at runtime.
7764
+ *
7765
+ * Note: avoid using this set directly, use the `isIframeSecuritySensitiveAttr` function
7766
+ * in the code instead.
7767
+ */
7768
+ const IFRAME_SECURITY_SENSITIVE_ATTRS = new Set(['sandbox', 'allow', 'allowfullscreen', 'referrerpolicy', 'csp', 'fetchpriority']);
7769
+ /**
7770
+ * Checks whether a given attribute name might represent a security-sensitive
7771
+ * attribute of an <iframe>.
7772
+ */
7773
+ function isIframeSecuritySensitiveAttr(attrName) {
7774
+ // The `setAttribute` DOM API is case-insensitive, so we lowercase the value
7775
+ // before checking it against a known security-sensitive attributes.
7776
+ return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
7777
+ }
7778
+
7686
7779
  /**
7687
7780
  * @license
7688
7781
  * Copyright Google LLC All Rights Reserved.
@@ -14774,79 +14867,6 @@ function mapLiteral(obj, quoted = false) {
14774
14867
  })));
14775
14868
  }
14776
14869
 
14777
- /**
14778
- * @license
14779
- * Copyright Google LLC All Rights Reserved.
14780
- *
14781
- * Use of this source code is governed by an MIT-style license that can be
14782
- * found in the LICENSE file at https://angular.io/license
14783
- */
14784
- // =================================================================================================
14785
- // =================================================================================================
14786
- // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
14787
- // =================================================================================================
14788
- // =================================================================================================
14789
- //
14790
- // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
14791
- // Reach out to mprobst for details.
14792
- //
14793
- // =================================================================================================
14794
- /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
14795
- let _SECURITY_SCHEMA;
14796
- function SECURITY_SCHEMA() {
14797
- if (!_SECURITY_SCHEMA) {
14798
- _SECURITY_SCHEMA = {};
14799
- // Case is insignificant below, all element and attribute names are lower-cased for lookup.
14800
- registerContext(SecurityContext.HTML, [
14801
- 'iframe|srcdoc',
14802
- '*|innerHTML',
14803
- '*|outerHTML',
14804
- ]);
14805
- registerContext(SecurityContext.STYLE, ['*|style']);
14806
- // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
14807
- registerContext(SecurityContext.URL, [
14808
- '*|formAction',
14809
- 'area|href',
14810
- 'area|ping',
14811
- 'audio|src',
14812
- 'a|href',
14813
- 'a|ping',
14814
- 'blockquote|cite',
14815
- 'body|background',
14816
- 'del|cite',
14817
- 'form|action',
14818
- 'img|src',
14819
- 'input|src',
14820
- 'ins|cite',
14821
- 'q|cite',
14822
- 'source|src',
14823
- 'track|src',
14824
- 'video|poster',
14825
- 'video|src',
14826
- ]);
14827
- registerContext(SecurityContext.RESOURCE_URL, [
14828
- 'applet|code',
14829
- 'applet|codebase',
14830
- 'base|href',
14831
- 'embed|src',
14832
- 'frame|src',
14833
- 'head|profile',
14834
- 'html|manifest',
14835
- 'iframe|src',
14836
- 'link|href',
14837
- 'media|src',
14838
- 'object|codebase',
14839
- 'object|data',
14840
- 'script|src',
14841
- ]);
14842
- }
14843
- return _SECURITY_SCHEMA;
14844
- }
14845
- function registerContext(ctx, specs) {
14846
- for (const spec of specs)
14847
- _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
14848
- }
14849
-
14850
14870
  /**
14851
14871
  * @license
14852
14872
  * Copyright Google LLC All Rights Reserved.
@@ -17910,9 +17930,19 @@ class TemplateDefinitionBuilder {
17910
17930
  const params = [];
17911
17931
  const [attrNamespace, attrName] = splitNsName(input.name);
17912
17932
  const isAttributeBinding = inputType === 1 /* BindingType.Attribute */;
17913
- const sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
17914
- if (sanitizationRef)
17933
+ let sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
17934
+ if (!sanitizationRef) {
17935
+ // If there was no sanitization function found based on the security context
17936
+ // of an attribute/property - check whether this attribute/property is
17937
+ // one of the security-sensitive <iframe> attributes (and that the current
17938
+ // element is actually an <iframe>).
17939
+ if (isIframeElement(element.name) && isIframeSecuritySensitiveAttr(input.name)) {
17940
+ sanitizationRef = importExpr(Identifiers.validateIframeAttribute);
17941
+ }
17942
+ }
17943
+ if (sanitizationRef) {
17915
17944
  params.push(sanitizationRef);
17945
+ }
17916
17946
  if (attrNamespace) {
17917
17947
  const namespaceLiteral = literal(attrNamespace);
17918
17948
  if (sanitizationRef) {
@@ -18977,6 +19007,9 @@ function isSingleElementTemplate(children) {
18977
19007
  function isTextNode(node) {
18978
19008
  return node instanceof Text$3 || node instanceof BoundText || node instanceof Icu$1;
18979
19009
  }
19010
+ function isIframeElement(tagName) {
19011
+ return tagName.toLowerCase() === 'iframe';
19012
+ }
18980
19013
  function hasTextChildrenOnly(children) {
18981
19014
  return children.every(isTextNode);
18982
19015
  }
@@ -19459,6 +19492,20 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
19459
19492
  if (sanitizerFn) {
19460
19493
  instructionParams.push(sanitizerFn);
19461
19494
  }
19495
+ else {
19496
+ // If there was no sanitization function found based on the security context
19497
+ // of an attribute/property binding - check whether this attribute/property is
19498
+ // one of the security-sensitive <iframe> attributes.
19499
+ // Note: for host bindings defined on a directive, we do not try to find all
19500
+ // possible places where it can be matched, so we can not determine whether
19501
+ // the host element is an <iframe>. In this case, if an attribute/binding
19502
+ // name is in the `IFRAME_SECURITY_SENSITIVE_ATTRS` set - append a validation
19503
+ // function, which would be invoked at runtime and would have access to the
19504
+ // underlying DOM element, check if it's an <iframe> and if so - runs extra checks.
19505
+ if (isIframeSecuritySensitiveAttr(bindingName)) {
19506
+ instructionParams.push(importExpr(Identifiers.validateIframeAttribute));
19507
+ }
19508
+ }
19462
19509
  updateVariables.push(...bindingExpr.stmts);
19463
19510
  if (instruction === Identifiers.hostProperty) {
19464
19511
  propertyBindings.push(instructionParams);
@@ -20287,7 +20334,7 @@ function publishFacade(global) {
20287
20334
  * Use of this source code is governed by an MIT-style license that can be
20288
20335
  * found in the LICENSE file at https://angular.io/license
20289
20336
  */
20290
- const VERSION = new Version('15.0.0-rc.2');
20337
+ const VERSION = new Version('15.0.0-rc.3');
20291
20338
 
20292
20339
  /**
20293
20340
  * @license
@@ -22319,7 +22366,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
22319
22366
  function compileDeclareClassMetadata(metadata) {
22320
22367
  const definitionMap = new DefinitionMap();
22321
22368
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
22322
- definitionMap.set('version', literal('15.0.0-rc.2'));
22369
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22323
22370
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22324
22371
  definitionMap.set('type', metadata.type);
22325
22372
  definitionMap.set('decorators', metadata.decorators);
@@ -22436,7 +22483,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
22436
22483
  function createDirectiveDefinitionMap(meta) {
22437
22484
  const definitionMap = new DefinitionMap();
22438
22485
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
22439
- definitionMap.set('version', literal('15.0.0-rc.2'));
22486
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22440
22487
  // e.g. `type: MyDirective`
22441
22488
  definitionMap.set('type', meta.internalType);
22442
22489
  if (meta.isStandalone) {
@@ -22675,7 +22722,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22675
22722
  function compileDeclareFactoryFunction(meta) {
22676
22723
  const definitionMap = new DefinitionMap();
22677
22724
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22678
- definitionMap.set('version', literal('15.0.0-rc.2'));
22725
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22679
22726
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22680
22727
  definitionMap.set('type', meta.internalType);
22681
22728
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22717,7 +22764,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22717
22764
  function createInjectableDefinitionMap(meta) {
22718
22765
  const definitionMap = new DefinitionMap();
22719
22766
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22720
- definitionMap.set('version', literal('15.0.0-rc.2'));
22767
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22721
22768
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22722
22769
  definitionMap.set('type', meta.internalType);
22723
22770
  // Only generate providedIn property if it has a non-null value
@@ -22775,7 +22822,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22775
22822
  function createInjectorDefinitionMap(meta) {
22776
22823
  const definitionMap = new DefinitionMap();
22777
22824
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22778
- definitionMap.set('version', literal('15.0.0-rc.2'));
22825
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22779
22826
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22780
22827
  definitionMap.set('type', meta.internalType);
22781
22828
  definitionMap.set('providers', meta.providers);
@@ -22812,7 +22859,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22812
22859
  function createNgModuleDefinitionMap(meta) {
22813
22860
  const definitionMap = new DefinitionMap();
22814
22861
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22815
- definitionMap.set('version', literal('15.0.0-rc.2'));
22862
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22816
22863
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22817
22864
  definitionMap.set('type', meta.internalType);
22818
22865
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22870,7 +22917,7 @@ function compileDeclarePipeFromMetadata(meta) {
22870
22917
  function createPipeDefinitionMap(meta) {
22871
22918
  const definitionMap = new DefinitionMap();
22872
22919
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22873
- definitionMap.set('version', literal('15.0.0-rc.2'));
22920
+ definitionMap.set('version', literal('15.0.0-rc.3'));
22874
22921
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22875
22922
  // e.g. `type: MyPipe`
22876
22923
  definitionMap.set('type', meta.internalType);