Skip to content

Commit 075e1f8

Browse files
authored
Update support for dynamic code compilation (#465)
Remove ability for default policy to manipulate executed value, instead throw an eval error in this situation.
1 parent d32bb50 commit 075e1f8

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

spec/index.bs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,8 +1749,7 @@ The Trusted Types portion of this algorithm uses |calleeRealm| and its CSP setti
17491749
</pre>
17501750
</div>
17511751

1752-
Given a [[ECMA-262#realm|realm]] (|calleeRealm|), a list of strings (|parameterStrings|), a string (|bodyString|), <ins> a string (|source|), an enum (|compilationType|), and a boolean |wasCodeLike|</ins>, this algorithm returns <del>normally</del><ins>the
1753-
source string to compile</ins> if compilation is allowed, and
1752+
Given a [[ECMA-262#realm|realm]] (|calleeRealm|), a list of strings (|parameterStrings|), a string (|bodyString|), <ins> a string (|source|), an enum (|compilationType|), and a boolean |wasCodeLike|</ins>, this algorithm returns normally if compilation is allowed, and
17541753
throws an "`EvalError`" if not:
17551754

17561755
1. <ins>If |wasCodeLike| is true, let |sourceToValidate| be a new instance of
@@ -1766,13 +1765,15 @@ throws an "`EvalError`" if not:
17661765
* `'script'` as |sinkGroup|,
17671766
* {{TrustedScript}} as |expectedType|.</ins>
17681767

1769-
2. <ins>If the algorithm throws an error, throw an {{EvalError}}.</ins>
1768+
1. <ins>If the algorithm throws an error, throw an {{EvalError}}.</ins>
17701769

1771-
3. Let |global| be a |calleeRealm|'s [=realm/global object=].
1770+
1. <ins>If |sourceString| is not equal to |source|, throw an {{EvalError}}.</ins>
17721771

1773-
4. Let |result| be "`Allowed`".
1772+
1. Let |global| be a |calleeRealm|'s [=realm/global object=].
17741773

1775-
5. For each |policy| in |global|'s <a for="global object" spec="CSP3">CSP list</a>:
1774+
1. Let |result| be "`Allowed`".
1775+
1776+
1. For each |policy| in |global|'s <a for="global object" spec="CSP3">CSP list</a>:
17761777

17771778
1. Let |source-list| be `null`.
17781779

@@ -1800,13 +1801,7 @@ throws an "`EvalError`" if not:
18001801
5. If |policy|'s [=policy/disposition=] is "`enforce`", then set |result| to
18011802
"`Blocked`".
18021803

1803-
6. If |result| is "`Blocked`", throw an `EvalError` exception.
1804-
1805-
7. <ins>Return |sourceString|.</ins>
1806-
1807-
Note: returning |sourceString| means that the string that gets
1808-
compiled is that returned by any [=default policy=] in the course of
1809-
executing [$Get Trusted Type compliant string$].
1804+
1. If |result| is "`Blocked`", throw an `EvalError` exception.
18101805

18111806
# Security Considerations # {#security-considerations}
18121807

0 commit comments

Comments
 (0)