From 398a20e93b94e8590505a05ff3a4fed4b887caad Mon Sep 17 00:00:00 2001 From: Antonio Sartori Date: Tue, 17 Dec 2024 11:34:59 +0100 Subject: [PATCH] Fix port-part matches algorithm for a null port input (#435) The algorithm was expecting a non-null possibly-empty string while being called with null or a non-empty string. Now the algorithm correctly handles a null or non-empty input string. --- index.bs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/index.bs b/index.bs index 7c2f6cbea7..c3681073c9 100644 --- a/index.bs +++ b/index.bs @@ -4153,16 +4153,19 @@ Content-Type: application/reports+json `port-part` matching - An ASCII string |input| `port-part` matches [=/URL=] |url| if a CSP source expression that - contained the first as a `port-part` could potentially match a URL containing the latter's [=url/port=] - and [=url/scheme=]. For example, "80" `port-part` matches matches http://example.com. + An ASCII string or null |input| `port-part` matches + [=/URL=] |url| if a CSP source expression that contained the first as a `port-part` could potentially match a URL containing the latter's + [=url/port=] and [=url/scheme=]. For example, "80" `port-part` matches + matches http://example.com.
    - 1. Assert: |input| is the empty string, "*", or a sequence of ASCII digits. + 1. Assert: |input| is null, "*", or a sequence of one or more ASCII digits. 2. If |input| is equal to "*", return "`Matches`". - 3. Let |normalizedInput| be null if |input| is the empty string; otherwise |input| interpreted as decimal number. + 3. Let |normalizedInput| be null if |input| null; otherwise |input| + interpreted as decimal number. 4. If |normalizedInput| equals |url|'s [=url/port=], return "`Matches`".