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 | class SafeValueImpl {
|
---|
9 | constructor(changingThisBreaksApplicationSecurity) {
|
---|
10 | this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
|
---|
11 | }
|
---|
12 | toString() {
|
---|
13 | return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}` +
|
---|
14 | ` (see https://g.co/ng/security#xss)`;
|
---|
15 | }
|
---|
16 | }
|
---|
17 | class SafeHtmlImpl extends SafeValueImpl {
|
---|
18 | getTypeName() {
|
---|
19 | return "HTML" /* Html */;
|
---|
20 | }
|
---|
21 | }
|
---|
22 | class SafeStyleImpl extends SafeValueImpl {
|
---|
23 | getTypeName() {
|
---|
24 | return "Style" /* Style */;
|
---|
25 | }
|
---|
26 | }
|
---|
27 | class SafeScriptImpl extends SafeValueImpl {
|
---|
28 | getTypeName() {
|
---|
29 | return "Script" /* Script */;
|
---|
30 | }
|
---|
31 | }
|
---|
32 | class SafeUrlImpl extends SafeValueImpl {
|
---|
33 | getTypeName() {
|
---|
34 | return "URL" /* Url */;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | class SafeResourceUrlImpl extends SafeValueImpl {
|
---|
38 | getTypeName() {
|
---|
39 | return "ResourceURL" /* ResourceUrl */;
|
---|
40 | }
|
---|
41 | }
|
---|
42 | export function unwrapSafeValue(value) {
|
---|
43 | return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity :
|
---|
44 | value;
|
---|
45 | }
|
---|
46 | export function allowSanitizationBypassAndThrow(value, type) {
|
---|
47 | const actualType = getSanitizationBypassType(value);
|
---|
48 | if (actualType != null && actualType !== type) {
|
---|
49 | // Allow ResourceURLs in URL contexts, they are strictly more trusted.
|
---|
50 | if (actualType === "ResourceURL" /* ResourceUrl */ && type === "URL" /* Url */)
|
---|
51 | return true;
|
---|
52 | throw new Error(`Required a safe ${type}, got a ${actualType} (see https://g.co/ng/security#xss)`);
|
---|
53 | }
|
---|
54 | return actualType === type;
|
---|
55 | }
|
---|
56 | export function getSanitizationBypassType(value) {
|
---|
57 | return value instanceof SafeValueImpl && value.getTypeName() || null;
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Mark `html` string as trusted.
|
---|
61 | *
|
---|
62 | * This function wraps the trusted string in `String` and brands it in a way which makes it
|
---|
63 | * recognizable to {@link htmlSanitizer} to be trusted implicitly.
|
---|
64 | *
|
---|
65 | * @param trustedHtml `html` string which needs to be implicitly trusted.
|
---|
66 | * @returns a `html` which has been branded to be implicitly trusted.
|
---|
67 | */
|
---|
68 | export function bypassSanitizationTrustHtml(trustedHtml) {
|
---|
69 | return new SafeHtmlImpl(trustedHtml);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Mark `style` string as trusted.
|
---|
73 | *
|
---|
74 | * This function wraps the trusted string in `String` and brands it in a way which makes it
|
---|
75 | * recognizable to {@link styleSanitizer} to be trusted implicitly.
|
---|
76 | *
|
---|
77 | * @param trustedStyle `style` string which needs to be implicitly trusted.
|
---|
78 | * @returns a `style` hich has been branded to be implicitly trusted.
|
---|
79 | */
|
---|
80 | export function bypassSanitizationTrustStyle(trustedStyle) {
|
---|
81 | return new SafeStyleImpl(trustedStyle);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * Mark `script` string as trusted.
|
---|
85 | *
|
---|
86 | * This function wraps the trusted string in `String` and brands it in a way which makes it
|
---|
87 | * recognizable to {@link scriptSanitizer} to be trusted implicitly.
|
---|
88 | *
|
---|
89 | * @param trustedScript `script` string which needs to be implicitly trusted.
|
---|
90 | * @returns a `script` which has been branded to be implicitly trusted.
|
---|
91 | */
|
---|
92 | export function bypassSanitizationTrustScript(trustedScript) {
|
---|
93 | return new SafeScriptImpl(trustedScript);
|
---|
94 | }
|
---|
95 | /**
|
---|
96 | * Mark `url` string as trusted.
|
---|
97 | *
|
---|
98 | * This function wraps the trusted string in `String` and brands it in a way which makes it
|
---|
99 | * recognizable to {@link urlSanitizer} to be trusted implicitly.
|
---|
100 | *
|
---|
101 | * @param trustedUrl `url` string which needs to be implicitly trusted.
|
---|
102 | * @returns a `url` which has been branded to be implicitly trusted.
|
---|
103 | */
|
---|
104 | export function bypassSanitizationTrustUrl(trustedUrl) {
|
---|
105 | return new SafeUrlImpl(trustedUrl);
|
---|
106 | }
|
---|
107 | /**
|
---|
108 | * Mark `url` string as trusted.
|
---|
109 | *
|
---|
110 | * This function wraps the trusted string in `String` and brands it in a way which makes it
|
---|
111 | * recognizable to {@link resourceUrlSanitizer} to be trusted implicitly.
|
---|
112 | *
|
---|
113 | * @param trustedResourceUrl `url` string which needs to be implicitly trusted.
|
---|
114 | * @returns a `url` which has been branded to be implicitly trusted.
|
---|
115 | */
|
---|
116 | export function bypassSanitizationTrustResourceUrl(trustedResourceUrl) {
|
---|
117 | return new SafeResourceUrlImpl(trustedResourceUrl);
|
---|
118 | }
|
---|
119 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnlwYXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29yZS9zcmMvc2FuaXRpemF0aW9uL2J5cGFzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFzREgsTUFBZSxhQUFhO0lBQzFCLFlBQW1CLHFDQUE2QztRQUE3QywwQ0FBcUMsR0FBckMscUNBQXFDLENBQVE7SUFBRyxDQUFDO0lBSXBFLFFBQVE7UUFDTixPQUFPLDBDQUEwQyxJQUFJLENBQUMscUNBQXFDLEVBQUU7WUFDekYscUNBQXFDLENBQUM7SUFDNUMsQ0FBQztDQUNGO0FBRUQsTUFBTSxZQUFhLFNBQVEsYUFBYTtJQUM3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