Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an |includeReportOnly| boolean argument to Does sink type require trusted types? #518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ Given a {{TrustedType}} type (|expectedType|), a [=realm/global object=] (|globa
1. If |input| has type |expectedType|, return stringified
|input| and abort these steps.
1. Let |requireTrustedTypes| be the result of executing [$Does sink type require trusted types?$] algorithm,
passing |global|, and |sinkGroup|.
passing |global|, |sinkGroup|, and true.
1. If |requireTrustedTypes| is `false`, return stringified |input| and abort these steps.
1. Let |convertedInput| be the result of executing [$Process value with a default policy$] with the same arguments as this algorithm.
1. If the algorithm threw an error, rethrow the error and abort the following steps.
Expand Down Expand Up @@ -1411,19 +1411,19 @@ Content-Security-Policy: trusted-types one two default

### <dfn abstract-op>Does sink type require trusted types?</dfn> ### {#does-sink-require-trusted-types}

Given a [=realm/global object=] (|global|), a string (|sinkGroup|) this algorithm
returns `true` if the [=injection sink=] requires a [=Trusted Type=], and
`false` otherwise.
Given a [=realm/global object=] (|global|), a string (|sinkGroup|) and a boolean (|includeReportOnly|) this algorithm
returns `true` if the [=injection sink=] requires a [=Trusted Type=], and `false` otherwise.

1. Let |result| be `false`.
1. Let |result| be false.
1. For each |policy| in |global|'s <a>CSP list</a>:
1. If |policy|'s <a>directive set</a> does not contain a <a>directive</a>
whose [=directive/name=] is `"require-trusted-types-for"`, skip to the next |policy|.
1. Let |directive| be the |policy|'s |directive set|'s [=directive=] whose name
is `"require-trusted-types-for"`
1. If |directive|'s [=directive/value=] does not contain a <a>trusted-types-sink-group</a> which is a match
for |sinkGroup|, skip to the next |policy|.
1. Set |result| to `true`.
1. Let |enforced| be true if |policy|'s [=policy/disposition=] is `"enforce"`, and false otherwise.
1. Set |result| to true if |enforced| is true, and set to |includeReportOnly| otherwise.
1. Return |result|.

### <dfn abstract-op>Should sink type mismatch violation be blocked by Content Security Policy?</dfn> ### {#should-block-sink-type-mismatch}
Expand Down
Loading