Skip to content

Conversation

@antongolub
Copy link
Member

@antongolub antongolub commented Sep 7, 2025

Fixes parsers issues

  const cases = [
      // CVE-2023-42282
      ['0x7f.1', true],

      // CVE-2024-29415
      ['127.1', true],
      ['2130706433', true],
      ['01200034567', false],
      ['012.1.2.3', false],
      ['000:0:0000::01', true],
      ['::fFFf:127.0.0.1', true],
      ['::fFFf:127.255.255.256', true]
    ]

    for (const [input, expected] of cases) {
      assert.equal(isPrivate(input), !!expected, `isPrivate(${input}) === ${!!expected}`)
      assert.equal(isPublic(input), !expected, `isPublic(${input}) === ${!expected}`)
    }
ip.isV4Format('255.255.255.256')   // true
ip.isV4('255.255.255.256')         // false

Extends test matrix

@antongolub antongolub added bug Something isn't working enhancement New feature or request labels Sep 7, 2025
@antongolub antongolub merged commit 78f0ff2 into main Sep 7, 2025
11 checks passed
@antongolub antongolub deleted the mvp branch September 7, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants