1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler/src/schema/dom_security_schema", ["require", "exports", "tslib", "@angular/compiler/src/core"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.SECURITY_SCHEMA = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var core_1 = require("@angular/compiler/src/core");
|
---|
22 | // =================================================================================================
|
---|
23 | // =================================================================================================
|
---|
24 | // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
|
---|
25 | // =================================================================================================
|
---|
26 | // =================================================================================================
|
---|
27 | //
|
---|
28 | // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
|
---|
29 | // Reach out to mprobst for details.
|
---|
30 | //
|
---|
31 | // =================================================================================================
|
---|
32 | /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
|
---|
33 | var _SECURITY_SCHEMA;
|
---|
34 | function SECURITY_SCHEMA() {
|
---|
35 | if (!_SECURITY_SCHEMA) {
|
---|
36 | _SECURITY_SCHEMA = {};
|
---|
37 | // Case is insignificant below, all element and attribute names are lower-cased for lookup.
|
---|
38 | registerContext(core_1.SecurityContext.HTML, [
|
---|
39 | 'iframe|srcdoc',
|
---|
40 | '*|innerHTML',
|
---|
41 | '*|outerHTML',
|
---|
42 | ]);
|
---|
43 | registerContext(core_1.SecurityContext.STYLE, ['*|style']);
|
---|
44 | // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
|
---|
45 | registerContext(core_1.SecurityContext.URL, [
|
---|
46 | '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
|
---|
47 | 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
|
---|
48 | 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
|
---|
49 | 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
|
---|
50 | ]);
|
---|
51 | registerContext(core_1.SecurityContext.RESOURCE_URL, [
|
---|
52 | 'applet|code',
|
---|
53 | 'applet|codebase',
|
---|
54 | 'base|href',
|
---|
55 | 'embed|src',
|
---|
56 | 'frame|src',
|
---|
57 | 'head|profile',
|
---|
58 | 'html|manifest',
|
---|
59 | 'iframe|src',
|
---|
60 | 'link|href',
|
---|
61 | 'media|src',
|
---|
62 | 'object|codebase',
|
---|
63 | 'object|data',
|
---|
64 | 'script|src',
|
---|
65 | ]);
|
---|
66 | }
|
---|
67 | return _SECURITY_SCHEMA;
|
---|
68 | }
|
---|
69 | exports.SECURITY_SCHEMA = SECURITY_SCHEMA;
|
---|
70 | function registerContext(ctx, specs) {
|
---|
71 | var e_1, _a;
|
---|
72 | try {
|
---|
73 | for (var specs_1 = tslib_1.__values(specs), specs_1_1 = specs_1.next(); !specs_1_1.done; specs_1_1 = specs_1.next()) {
|
---|
74 | var spec = specs_1_1.value;
|
---|
75 | _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
|
---|
76 | }
|
---|
77 | }
|
---|
78 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
79 | finally {
|
---|
80 | try {
|
---|
81 | if (specs_1_1 && !specs_1_1.done && (_a = specs_1.return)) _a.call(specs_1);
|
---|
82 | }
|
---|
83 | finally { if (e_1) throw e_1.error; }
|
---|
84 | }
|
---|
85 | }
|
---|
86 | });
|
---|
87 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLC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lDb250ZXh0fSBmcm9tICcuLi9jb3JlJztcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy8gPT09PT09PT09PT0gUyBUIE8gUCAgIC0gIFMgVCBPIFAgICAtICBTIFQgTyBQICAgLSAgUyBUIE8gUCAgIC0gIFMgVCBPIFAgICAtICBTIFQgTyBQICA9PT09PT09PT09PVxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy9cbi8vICAgICAgICBETyBOT1QgRURJVCBUSElTIExJU1QgT0YgU0VDVVJJVFkgU0VOU0lUSVZFIFBST1BFUlRJRVMgV0lUSE9VVCBBIFNFQ1VSSVRZIFJFVklFVyFcbi8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlYWNoIG91dCB0byBtcHJvYnN0IGZvciBkZXRhaWxzLlxuLy9cbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuLyoqIE1hcCBmcm9tIHRhZ05hbWV8cHJvcGVydHlOYW1lIHRvIFNlY3VyaXR5Q29udGV4dC4gUHJvcGVydGllcyBhcHBseWluZyB0byBhbGwgdGFncyB1c2UgJyonLiAqL1xubGV0IF9TRUNVUklUWV9T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