Commit 9a316d7
authored
fix(ip-validation): implement strict IPv4 format validation (#2429)
* fix(regex): correct IP validation to handle IPv4 edge cases and robust IPv6
* enhance(regex): improve IP extractor to prevent false positives and enforce IPv4 octet ranges
Tighten IPv4 pattern to enforce 0-255 per octet, rejecting invalid addresses like 256.256.256.256 and 999.999.999.999
Replace loose IPv6 matcher with comprehensive pattern covering full, compressed, link-local with zone IDs, and IPv4-embedded forms1 parent 0908783 commit 9a316d7
File tree
2 files changed
+40
-20
lines changed- Specialized Areas/Regular Expressions/IP Address Validation
2 files changed
+40
-20
lines changedLines changed: 17 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 3 | + | |
9 | 4 | | |
10 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
11 | 9 | | |
12 | | - | |
| 10 | + | |
13 | 11 | | |
14 | | - | |
| 12 | + | |
15 | 13 | | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 20 | + | |
25 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | | - | |
3 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
4 | 25 | | |
5 | 26 | | |
0 commit comments