Re: [whatwg/url] Reject non-IPv4 hostnames that end in numbers. (#619)

@annevk commented on this pull request.

This seems like something we should be doing in name of security. Copying @valenting to be sure, but I think I can say Mozilla is supportive of this effort.

>  
  <li><p>Return <var>asciiDomain</var>.
 </ol>
 
 <hr>
 
+<p>The <dfn id=ends-in-a-number>ends in a number checker</dfn> takes a string <var>input</var> and
+then runs these steps:
+
+<ol>
+ <li><p>Let <var>parts</var> be the result of <a>strictly splitting</a> <var>input</var> on
+ U+002E (.).
+
+ <li>
+  <p>If the last <a for=list>item</a> in <var>parts</var> is the empty string, then:
+
+  <ol>
+   <li><p>If <var>parts</var>'s <a for=list>size</a> is 1, return false.

```suggestion
   <li><p>If <var>parts</var>'s <a for=list>size</a> is 1, then return false.
```

>  
  <li><p>Return <var>asciiDomain</var>.
 </ol>
 
 <hr>
 
+<p>The <dfn id=ends-in-a-number>ends in a number checker</dfn> takes a string <var>input</var> and
+then runs these steps:
+
+<ol>
+ <li><p>Let <var>parts</var> be the result of <a>strictly splitting</a> <var>input</var> on
+ U+002E (.).
+
+ <li>
+  <p>If the last <a for=list>item</a> in <var>parts</var> is the empty string, then:
+
+  <ol>
+   <li><p>If <var>parts</var>'s <a for=list>size</a> is 1, return false.
+
+   <li><p><a for=list>remove</a> the last <a for=list>item</a> from <var>parts</var>.

```suggestion
   <li><p><a for=list>Remove</a> the last <a for=list>item</a> from <var>parts</var>.
```

> +then runs these steps:
+
+<ol>
+ <li><p>Let <var>parts</var> be the result of <a>strictly splitting</a> <var>input</var> on
+ U+002E (.).
+
+ <li>
+  <p>If the last <a for=list>item</a> in <var>parts</var> is the empty string, then:
+
+  <ol>
+   <li><p>If <var>parts</var>'s <a for=list>size</a> is 1, return false.
+
+   <li><p><a for=list>remove</a> the last <a for=list>item</a> from <var>parts</var>.
+  </ol>
+
+ <li><p>Let <var>last</var> be the last <a for=list>item</a> from <var>parts</var>.

```suggestion
 <li><p>Let <var>last</var> be the last <a for=list>item</a> in <var>parts</var>.
```
(for consistency with earlier)

> + <li><p>Let <var>parts</var> be the result of <a>strictly splitting</a> <var>input</var> on
+ U+002E (.).
+
+ <li>
+  <p>If the last <a for=list>item</a> in <var>parts</var> is the empty string, then:
+
+  <ol>
+   <li><p>If <var>parts</var>'s <a for=list>size</a> is 1, return false.
+
+   <li><p><a for=list>remove</a> the last <a for=list>item</a> from <var>parts</var>.
+  </ol>
+
+ <li><p>Let <var>last</var> be the last <a for=list>item</a> from <var>parts</var>.
+
+ <li><p>If parsing <var>last</var> as an <a lt="IPv4 number parser">IPv4 number</a> does not
+ return failure, return true.

```suggestion
 return failure, then return true.
```

> +
+ <li>
+  <p>If the last <a for=list>item</a> in <var>parts</var> is the empty string, then:
+
+  <ol>
+   <li><p>If <var>parts</var>'s <a for=list>size</a> is 1, return false.
+
+   <li>Otherwise, <a for=list>remove</a> the last <a for=list>item</a> from <var>parts</var>.
+  </ol>
+
+ <li><p>Let <var>last</var> be the last <a for=list>item</a> from <var>parts</var>.
+
+ <li>If parsing <var>last</var> as an <a lt="IPv4 number parser">IPv4 number</a> does not
+ return failure, return true.
+
+ <li><p>If <var>last</var> is non-empty and contains only <a>ASCII digits</a>, return true.

The `<p>` needs to be on a newline as the `<li>` has two children now. Also "then return".

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/619#pullrequestreview-710507288

Received on Tuesday, 20 July 2021 12:20:34 UTC