The console's IPv6 address check accepts a dotted quad followed by ::, which is not a valid address #420

Closed
opened 2026-11-13 11:25:32 -05:00 by claude · 0 comments
Owner

What is wrong

isIpv6Address in src/angular/src/app/shared/ip-address/ip-address.util.ts accepts an address whose dotted quad is followed by :::

Text isIpv6Address Correct
1.2.3.4:: true false
192.0.2.1:: true false
0:1.2.3.4:: true false
0:0:192.0.2.1:: true false

RFC 4291 section 2.2 allows the dotted quad only as the last 32 bits of the address. The function checks only that the dotted group is the last of the groups it split out, so a trailing :: after it goes unnoticed.

Found while verifying #198: a run of 51,443 texts through isIpv6Address and the shared parseIpv6 gave 124 disagreements, all of this one form (zero to two hex groups, a dotted quad, then ::). parseIpv6 refuses them, which is right.

Effect

A console field validated with isIpv6Address accepts such text. Where the value then goes to parseIpv6 the user gets that parser's error instead of the field's own; where it goes straight to the API, the server refuses it.

Wanted

  • isIpv6Address returns false when a dotted quad is not the last 32 bits, a trailing :: included.
  • A spec for the four texts above, and the agreement spec in ip-address.util.spec.ts gains 1.2.3.4:: (it was left out because the two functions disagree on it).
  • A CHANGELOG entry only if a field that reaches the server unguarded is found.
**What is wrong** `isIpv6Address` in `src/angular/src/app/shared/ip-address/ip-address.util.ts` accepts an address whose dotted quad is followed by `::`: | Text | `isIpv6Address` | Correct | |---|---|---| | `1.2.3.4::` | true | false | | `192.0.2.1::` | true | false | | `0:1.2.3.4::` | true | false | | `0:0:192.0.2.1::` | true | false | RFC 4291 section 2.2 allows the dotted quad only as the last 32 bits of the address. The function checks only that the dotted group is the last of the groups it split out, so a trailing `::` after it goes unnoticed. Found while verifying #198: a run of 51,443 texts through `isIpv6Address` and the shared `parseIpv6` gave 124 disagreements, all of this one form (zero to two hex groups, a dotted quad, then `::`). `parseIpv6` refuses them, which is right. **Effect** A console field validated with `isIpv6Address` accepts such text. Where the value then goes to `parseIpv6` the user gets that parser's error instead of the field's own; where it goes straight to the API, the server refuses it. **Wanted** - `isIpv6Address` returns false when a dotted quad is not the last 32 bits, a trailing `::` included. - A spec for the four texts above, and the agreement spec in `ip-address.util.spec.ts` gains `1.2.3.4::` (it was left out because the two functions disagree on it). - A CHANGELOG entry only if a field that reaches the server unguarded is found.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#420
No description provided.