Skip to content

Commit

Permalink
Fix port-part matches algorithm for a null port input (#435)
Browse files Browse the repository at this point in the history
SHA: 398a20e
Reason: push, by antosart

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
antosart and github-actions[bot] committed Dec 17, 2024
1 parent 86142f0 commit 3849353
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<title>Content Security Policy Level 3</title>
<meta content="WD" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-WD" rel="stylesheet">
<meta content="Bikeshed version 742f3d674, updated Mon Nov 4 14:56:54 2024 -0800" name="generator">
<meta content="Bikeshed version ac5ea272d, updated Fri Dec 6 15:45:15 2024 -0800" name="generator">
<link href="https://www.w3.org/TR/CSP3/" rel="canonical">
<meta content="19c98a2acc722e4e3f6dc271e56be8f08c6a50ca" name="revision">
<meta content="398a20e93b94e8590505a05ff3a4fed4b887caad" name="revision">
<meta content="dark light" name="color-scheme">
<link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css">
<style>
Expand Down Expand Up @@ -771,13 +771,13 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1>Content Security Policy Level 3</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#WD">W3C Working Draft</a>, <time class="dt-updated" datetime="2024-12-06">6 December 2024</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#WD">W3C Working Draft</a>, <time class="dt-updated" datetime="2024-12-17">17 December 2024</time></p>
<details open>
<summary>More details about this document</summary>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://www.w3.org/TR/2024/WD-CSP3-20241206/">https://www.w3.org/TR/2024/WD-CSP3-20241206/</a>
<dd><a class="u-url" href="https://www.w3.org/TR/2024/WD-CSP3-20241217/">https://www.w3.org/TR/2024/WD-CSP3-20241217/</a>
<dt>Latest published version:
<dd><a href="https://www.w3.org/TR/CSP3/">https://www.w3.org/TR/CSP3/</a>
<dt>Editor's Draft:
Expand Down Expand Up @@ -4205,15 +4205,14 @@ <h5 class="heading settled algorithm" data-algorithm="host-part matching" data-l
<p>Return "<code>Matches</code>".</p>
</ol>
<h5 class="heading settled algorithm" data-algorithm="port-part matching" data-level="6.7.2.11" id="match-ports"><span class="secno">6.7.2.11. </span><span class="content"> <code>port-part</code> matching </span><a class="self-link" href="#match-ports"></a></h5>
<p>An <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string①⓪">ASCII string</a> <var>input</var> <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="port-part-matches"><code>port-part</code> matches</dfn> <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url③">URL</a> <var>url</var> if a CSP source expression that
contained the first as a <a data-link-type="grammar" href="#grammardef-port-part" id="ref-for-grammardef-port-part②"><code>port-part</code></a> could potentially match a URL containing the latter’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-port" id="ref-for-concept-url-port">port</a> and <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-scheme" id="ref-for-concept-url-scheme①②">scheme</a>. For example, "80" <a data-link-type="dfn" href="#port-part-matches" id="ref-for-port-part-matches①"><code>port-part</code> matches</a> matches http://example.com.</p>
<p>An <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string①⓪">ASCII string</a> or null <var>input</var> <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="port-part-matches"><code>port-part</code> matches</dfn> <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url" id="ref-for-concept-url③">URL</a> <var>url</var> if a CSP source expression that contained the first as a <a data-link-type="grammar" href="#grammardef-port-part" id="ref-for-grammardef-port-part②"><code>port-part</code></a> could potentially match a URL containing the latter’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-port" id="ref-for-concept-url-port">port</a> and <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-scheme" id="ref-for-concept-url-scheme①②">scheme</a>. For example, "80" <a data-link-type="dfn" href="#port-part-matches" id="ref-for-port-part-matches①"><code>port-part</code> matches</a> matches http://example.com.</p>
<ol class="algorithm">
<li data-md>
<p class="assertion">Assert: <var>input</var> is the empty string, "*", or a sequence of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit">ASCII digits</a>.</p>
<p class="assertion">Assert: <var>input</var> is null, "*", or a sequence of one or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit">ASCII digits</a>.</p>
<li data-md>
<p>If <var>input</var> is equal to "*", return "<code>Matches</code>".</p>
<li data-md>
<p>Let <var>normalizedInput</var> be null if <var>input</var> is the empty string; otherwise <var>input</var> interpreted as decimal number.</p>
<p>Let <var>normalizedInput</var> be null if <var>input</var> null; otherwise <var>input</var> interpreted as decimal number.</p>
<li data-md>
<p>If <var>normalizedInput</var> equals <var>url</var>’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-port" id="ref-for-concept-url-port①">port</a>, return "<code>Matches</code>".</p>
<li data-md>
Expand Down Expand Up @@ -5829,7 +5828,7 @@ <h3 class="no-num no-ref heading settled" id="normative"><span class="content">N
<dt id="biblio-sri">[SRI]
<dd>Devdatta Akhawe; et al. <a href="https://www.w3.org/TR/SRI/"><cite>Subresource Integrity</cite></a>. 23 June 2016. REC. URL: <a href="https://www.w3.org/TR/SRI/">https://www.w3.org/TR/SRI/</a>
<dt id="biblio-trusted-types">[TRUSTED-TYPES]
<dd>Krzysztof Kotowicz. <a href="https://www.w3.org/TR/trusted-types/"><cite>Trusted Types</cite></a>. 18 November 2024. WD. URL: <a href="https://www.w3.org/TR/trusted-types/">https://www.w3.org/TR/trusted-types/</a>
<dd>Krzysztof Kotowicz. <a href="https://www.w3.org/TR/trusted-types/"><cite>Trusted Types</cite></a>. 21 November 2024. WD. URL: <a href="https://www.w3.org/TR/trusted-types/">https://www.w3.org/TR/trusted-types/</a>
<dt id="biblio-url">[URL]
<dd>Anne van Kesteren. <a href="https://url.spec.whatwg.org/"><cite>URL Standard</cite></a>. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a>
<dt id="biblio-webidl">[WEBIDL]
Expand Down

0 comments on commit 3849353

Please sign in to comment.