Not validating properly (IPV4 with block >= 256 still returns true)
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
The methods `ip.isV4Format()` and `ip.isV6Format()` are returning `true` for an invalid IP address:
```javascript
const ipAddress = "103.23.133.256";
console.log(ipAddress, ip.isV4Format(ipAddress), ip.isV6Format(ipAddress));
// > 103.23.133.256 true true
```
Should this not validate each block so that V4 blocks > 255 would case the function to return `false`? Also, since V4 and V6 addresses have different delimiters (colons/periods) that passing a V4 address into the `isV6Format` function should return false as well?
Would it be possible to add a validation method that accepts both V4 and V6 addresses and validates them?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the isV4Format() and isV6Format() entry points and reading how each currently validates an address. Check any existing validation tests, then cover blocks above 255, reject IPv4 input in the IPv6 check, and define the expected behavior for validation of either format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100