Skip to content

IPv6 regex accepts invalid formats #2039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zaelgohary opened this issue Sep 13, 2022 · 4 comments
Closed

IPv6 regex accepts invalid formats #2039

zaelgohary opened this issue Sep 13, 2022 · 4 comments

Comments

@zaelgohary
Copy link

zaelgohary commented Sep 13, 2022

Describe the bug
IPv6 regex accepts invalid formats.

Examples

  • BC:e4d5:c:e7b9::%40i0nccymtl9cwfKo.5vaeXLSGRMe:EDh2qs5wkhnPws5xQKqafjfAMm6wGFCJ.bVFsZfb
  • 1dC:0DF8:62D:3AC::%KTatXocjaFVioS0RTNQl4mA.V151o0RSy.JIu-D-D8.d3171ZWsSJ7PK4YjkJCRN0F

Recommended Fix
The issue can be fixed by changing lines 44 & 45 in isIP.js file to the following:
(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:)) +
')([0-9a-fA-F]{1})?$');

Additional context
Validator.js version: 13.7.0
Node.js version: v16.14.2
OS platform: Linux

@WikiRik
Copy link
Member

WikiRik commented Sep 13, 2022

Feel free to open a PR that fixes this and adds additional tests

@zaelgohary
Copy link
Author

Tried to push the fix on a new branch and then open a PR but permission was denied as shown below.
image

@WikiRik
Copy link
Member

WikiRik commented Sep 14, 2022

You should push it to your own fork and then you can open a PR towards this repo

ShreySinha02 pushed a commit to ShreySinha02/validator.js that referenced this issue Sep 14, 2024
@ShreySinha02
Copy link
Contributor

Please review this #2453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy