Skip to content

fix #2039 IPv6 regex accepts invalid formats #2453

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

Merged
merged 5 commits into from
Mar 28, 2025

Conversation

ShreySinha02
Copy link
Contributor

@ShreySinha02 ShreySinha02 commented Sep 14, 2024

Fixed the incorrect IPv6 address formats:

BC:e4d5:c:e7b9::%40i0nccymtl9cwfKo.5vaeXLSGRMe:EDh2qs5wkhnPws5xQKqafjfAMm6wGFCJ.bVFsZfb
1dC:0DF8:62D:3AC::%KTatXocjaFVioS0RTNQl4mA.V151o0RSy.JIu-D-D8.d3171ZWsSJ7PK4YjkJCRN0F
These addresses are now correctly identified as invalid.

Updated the IPv6 address validation regex to correctly handle and reject invalid IPv6 address formats. The previous regex allowed formats that were not compliant with IPv6 standards. This fix ensures that only valid IPv6 addresses are accepted.

The validation structure is based on the corrected regex from branch #2083, which had merge conflicts that were resolved for accurate validation. This reference ensures that the updated regex conforms to the expected IPv6 address format and resolves the issue with invalid formats.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

@WikiRik
Copy link
Member

WikiRik commented Mar 26, 2025

Due to the merger of #2089 this PR also has merge conflicts. Can you resolve them?

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for rebasing! The isIP tests are now moved to https://github.com/validatorjs/validator.js/blob/master/test/validators/isIP.test.js
Can you add the new test cases there? And remove the empty line you've added to the main test file?

@WikiRik WikiRik requested a review from rubiin March 28, 2025 06:51
@WikiRik WikiRik merged commit 90c19e8 into validatorjs:master Mar 28, 2025
2 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 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