@angular/compiler 13.3.11 → 13.3.12

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 v13.3.11
2
+ * @license Angular v13.3.12
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 v13.3.11
2
+ * @license Angular v13.3.12
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2933,6 +2933,7 @@ Identifiers.sanitizeUrl = { name: 'ɵɵsanitizeUrl', moduleName: CORE };
2933
2933
  Identifiers.sanitizeUrlOrResourceUrl = { name: 'ɵɵsanitizeUrlOrResourceUrl', moduleName: CORE };
2934
2934
  Identifiers.trustConstantHtml = { name: 'ɵɵtrustConstantHtml', moduleName: CORE };
2935
2935
  Identifiers.trustConstantResourceUrl = { name: 'ɵɵtrustConstantResourceUrl', moduleName: CORE };
2936
+ Identifiers.validateIframeAttribute = { name: 'ɵɵvalidateIframeAttribute', moduleName: CORE };
2936
2937
 
2937
2938
  /**
2938
2939
  * @license
@@ -7665,6 +7666,84 @@ class BuiltinFunctionCall extends Call {
7665
7666
  }
7666
7667
  }
7667
7668
 
7669
+ /**
7670
+ * @license
7671
+ * Copyright Google LLC All Rights Reserved.
7672
+ *
7673
+ * Use of this source code is governed by an MIT-style license that can be
7674
+ * found in the LICENSE file at https://angular.io/license
7675
+ */
7676
+ // =================================================================================================
7677
+ // =================================================================================================
7678
+ // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
7679
+ // =================================================================================================
7680
+ // =================================================================================================
7681
+ //
7682
+ // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
7683
+ // Reach out to mprobst for details.
7684
+ //
7685
+ // =================================================================================================
7686
+ /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
7687
+ let _SECURITY_SCHEMA;
7688
+ function SECURITY_SCHEMA() {
7689
+ if (!_SECURITY_SCHEMA) {
7690
+ _SECURITY_SCHEMA = {};
7691
+ // Case is insignificant below, all element and attribute names are lower-cased for lookup.
7692
+ registerContext(SecurityContext.HTML, [
7693
+ 'iframe|srcdoc',
7694
+ '*|innerHTML',
7695
+ '*|outerHTML',
7696
+ ]);
7697
+ registerContext(SecurityContext.STYLE, ['*|style']);
7698
+ // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
7699
+ registerContext(SecurityContext.URL, [
7700
+ '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
7701
+ 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
7702
+ 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
7703
+ 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
7704
+ ]);
7705
+ registerContext(SecurityContext.RESOURCE_URL, [
7706
+ 'applet|code',
7707
+ 'applet|codebase',
7708
+ 'base|href',
7709
+ 'embed|src',
7710
+ 'frame|src',
7711
+ 'head|profile',
7712
+ 'html|manifest',
7713
+ 'iframe|src',
7714
+ 'link|href',
7715
+ 'media|src',
7716
+ 'object|codebase',
7717
+ 'object|data',
7718
+ 'script|src',
7719
+ ]);
7720
+ }
7721
+ return _SECURITY_SCHEMA;
7722
+ }
7723
+ function registerContext(ctx, specs) {
7724
+ for (const spec of specs)
7725
+ _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
7726
+ }
7727
+ /**
7728
+ * The set of security-sensitive attributes of an `<iframe>` that *must* be
7729
+ * applied as a static attribute only. This ensures that all security-sensitive
7730
+ * attributes are taken into account while creating an instance of an `<iframe>`
7731
+ * at runtime.
7732
+ *
7733
+ * Note: avoid using this set directly, use the `isIframeSecuritySensitiveAttr` function
7734
+ * in the code instead.
7735
+ */
7736
+ const IFRAME_SECURITY_SENSITIVE_ATTRS = new Set(['sandbox', 'allow', 'allowfullscreen', 'referrerpolicy', 'csp', 'fetchpriority']);
7737
+ /**
7738
+ * Checks whether a given attribute name might represent a security-sensitive
7739
+ * attribute of an <iframe>.
7740
+ */
7741
+ function isIframeSecuritySensitiveAttr(attrName) {
7742
+ // The `setAttribute` DOM API is case-insensitive, so we lowercase the value
7743
+ // before checking it against a known security-sensitive attributes.
7744
+ return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
7745
+ }
7746
+
7668
7747
  /**
7669
7748
  * @license
7670
7749
  * Copyright Google LLC All Rights Reserved.
@@ -14488,65 +14567,6 @@ function mapLiteral(obj, quoted = false) {
14488
14567
  })));
14489
14568
  }
14490
14569
 
14491
- /**
14492
- * @license
14493
- * Copyright Google LLC All Rights Reserved.
14494
- *
14495
- * Use of this source code is governed by an MIT-style license that can be
14496
- * found in the LICENSE file at https://angular.io/license
14497
- */
14498
- // =================================================================================================
14499
- // =================================================================================================
14500
- // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
14501
- // =================================================================================================
14502
- // =================================================================================================
14503
- //
14504
- // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
14505
- // Reach out to mprobst for details.
14506
- //
14507
- // =================================================================================================
14508
- /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
14509
- let _SECURITY_SCHEMA;
14510
- function SECURITY_SCHEMA() {
14511
- if (!_SECURITY_SCHEMA) {
14512
- _SECURITY_SCHEMA = {};
14513
- // Case is insignificant below, all element and attribute names are lower-cased for lookup.
14514
- registerContext(SecurityContext.HTML, [
14515
- 'iframe|srcdoc',
14516
- '*|innerHTML',
14517
- '*|outerHTML',
14518
- ]);
14519
- registerContext(SecurityContext.STYLE, ['*|style']);
14520
- // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
14521
- registerContext(SecurityContext.URL, [
14522
- '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
14523
- 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
14524
- 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
14525
- 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
14526
- ]);
14527
- registerContext(SecurityContext.RESOURCE_URL, [
14528
- 'applet|code',
14529
- 'applet|codebase',
14530
- 'base|href',
14531
- 'embed|src',
14532
- 'frame|src',
14533
- 'head|profile',
14534
- 'html|manifest',
14535
- 'iframe|src',
14536
- 'link|href',
14537
- 'media|src',
14538
- 'object|codebase',
14539
- 'object|data',
14540
- 'script|src',
14541
- ]);
14542
- }
14543
- return _SECURITY_SCHEMA;
14544
- }
14545
- function registerContext(ctx, specs) {
14546
- for (const spec of specs)
14547
- _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
14548
- }
14549
-
14550
14570
  /**
14551
14571
  * @license
14552
14572
  * Copyright Google LLC All Rights Reserved.
@@ -17543,9 +17563,19 @@ class TemplateDefinitionBuilder {
17543
17563
  const params = [];
17544
17564
  const [attrNamespace, attrName] = splitNsName(input.name);
17545
17565
  const isAttributeBinding = inputType === 1 /* Attribute */;
17546
- const sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
17547
- if (sanitizationRef)
17566
+ let sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
17567
+ if (!sanitizationRef) {
17568
+ // If there was no sanitization function found based on the security context
17569
+ // of an attribute/property - check whether this attribute/property is
17570
+ // one of the security-sensitive <iframe> attributes (and that the current
17571
+ // element is actually an <iframe>).
17572
+ if (isIframeElement(element.name) && isIframeSecuritySensitiveAttr(input.name)) {
17573
+ sanitizationRef = importExpr(Identifiers.validateIframeAttribute);
17574
+ }
17575
+ }
17576
+ if (sanitizationRef) {
17548
17577
  params.push(sanitizationRef);
17578
+ }
17549
17579
  if (attrNamespace) {
17550
17580
  const namespaceLiteral = literal(attrNamespace);
17551
17581
  if (sanitizationRef) {
@@ -18611,6 +18641,9 @@ function isSingleElementTemplate(children) {
18611
18641
  function isTextNode(node) {
18612
18642
  return node instanceof Text$3 || node instanceof BoundText || node instanceof Icu$1;
18613
18643
  }
18644
+ function isIframeElement(tagName) {
18645
+ return tagName.toLowerCase() === 'iframe';
18646
+ }
18614
18647
  function hasTextChildrenOnly(children) {
18615
18648
  return children.every(isTextNode);
18616
18649
  }
@@ -19078,6 +19111,20 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
19078
19111
  if (sanitizerFn) {
19079
19112
  instructionParams.push(sanitizerFn);
19080
19113
  }
19114
+ else {
19115
+ // If there was no sanitization function found based on the security context
19116
+ // of an attribute/property binding - check whether this attribute/property is
19117
+ // one of the security-sensitive <iframe> attributes.
19118
+ // Note: for host bindings defined on a directive, we do not try to find all
19119
+ // possible places where it can be matched, so we can not determine whether
19120
+ // the host element is an <iframe>. In this case, if an attribute/binding
19121
+ // name is in the `IFRAME_SECURITY_SENSITIVE_ATTRS` set - append a validation
19122
+ // function, which would be invoked at runtime and would have access to the
19123
+ // underlying DOM element, check if it's an <iframe> and if so - runs extra checks.
19124
+ if (isIframeSecuritySensitiveAttr(bindingName)) {
19125
+ instructionParams.push(importExpr(Identifiers.validateIframeAttribute));
19126
+ }
19127
+ }
19081
19128
  updateVariables.push(...bindingExpr.stmts);
19082
19129
  if (instruction === Identifiers.hostProperty) {
19083
19130
  propertyBindings.push(instructionParams);
@@ -19783,7 +19830,7 @@ function publishFacade(global) {
19783
19830
  * Use of this source code is governed by an MIT-style license that can be
19784
19831
  * found in the LICENSE file at https://angular.io/license
19785
19832
  */
19786
- const VERSION = new Version('13.3.11');
19833
+ const VERSION = new Version('13.3.12');
19787
19834
 
19788
19835
  /**
19789
19836
  * @license
@@ -21824,7 +21871,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21824
21871
  function compileDeclareClassMetadata(metadata) {
21825
21872
  const definitionMap = new DefinitionMap();
21826
21873
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21827
- definitionMap.set('version', literal('13.3.11'));
21874
+ definitionMap.set('version', literal('13.3.12'));
21828
21875
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21829
21876
  definitionMap.set('type', metadata.type);
21830
21877
  definitionMap.set('decorators', metadata.decorators);
@@ -21941,7 +21988,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21941
21988
  function createDirectiveDefinitionMap(meta) {
21942
21989
  const definitionMap = new DefinitionMap();
21943
21990
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21944
- definitionMap.set('version', literal('13.3.11'));
21991
+ definitionMap.set('version', literal('13.3.12'));
21945
21992
  // e.g. `type: MyDirective`
21946
21993
  definitionMap.set('type', meta.internalType);
21947
21994
  // e.g. `selector: 'some-dir'`
@@ -22162,7 +22209,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22162
22209
  function compileDeclareFactoryFunction(meta) {
22163
22210
  const definitionMap = new DefinitionMap();
22164
22211
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22165
- definitionMap.set('version', literal('13.3.11'));
22212
+ definitionMap.set('version', literal('13.3.12'));
22166
22213
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22167
22214
  definitionMap.set('type', meta.internalType);
22168
22215
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22204,7 +22251,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22204
22251
  function createInjectableDefinitionMap(meta) {
22205
22252
  const definitionMap = new DefinitionMap();
22206
22253
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22207
- definitionMap.set('version', literal('13.3.11'));
22254
+ definitionMap.set('version', literal('13.3.12'));
22208
22255
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22209
22256
  definitionMap.set('type', meta.internalType);
22210
22257
  // Only generate providedIn property if it has a non-null value
@@ -22262,7 +22309,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22262
22309
  function createInjectorDefinitionMap(meta) {
22263
22310
  const definitionMap = new DefinitionMap();
22264
22311
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22265
- definitionMap.set('version', literal('13.3.11'));
22312
+ definitionMap.set('version', literal('13.3.12'));
22266
22313
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22267
22314
  definitionMap.set('type', meta.internalType);
22268
22315
  definitionMap.set('providers', meta.providers);
@@ -22299,7 +22346,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22299
22346
  function createNgModuleDefinitionMap(meta) {
22300
22347
  const definitionMap = new DefinitionMap();
22301
22348
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22302
- definitionMap.set('version', literal('13.3.11'));
22349
+ definitionMap.set('version', literal('13.3.12'));
22303
22350
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22304
22351
  definitionMap.set('type', meta.internalType);
22305
22352
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22357,7 +22404,7 @@ function compileDeclarePipeFromMetadata(meta) {
22357
22404
  function createPipeDefinitionMap(meta) {
22358
22405
  const definitionMap = new DefinitionMap();
22359
22406
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22360
- definitionMap.set('version', literal('13.3.11'));
22407
+ definitionMap.set('version', literal('13.3.12'));
22361
22408
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22362
22409
  // e.g. `type: MyPipe`
22363
22410
  definitionMap.set('type', meta.internalType);