You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ip, ipv6): reject non-ASCII characters accepted by Unicode case folding - #1750
IPV6_REGEX and IP_REGEX used both the i and u flags, so the zone ID character class matched U+017F (long s) and U+212A (Kelvin sign) via Unicode case folding (for example, fe80::1%\u017F and fe80::1%\u212A).
This spells out uppercase ASCII ranges explicitly and drops the i flag (matching #1719 for base64), keeping all ASCII IPv6/IP matching unchanged while rejecting non-ASCII zone ID characters.
Summary by CodeRabbit
Bug Fixes
Improved IPv6 address validation to correctly handle scoped addresses and IPv4-mapped addresses, while rejecting scoped addresses with certain non-ASCII zone identifiers.
No actionable comments were generated in the recent review.
Walkthrough
The IPv6 regexes now use explicit upper- and lowercase character classes with the Unicode flag. Tests add valid scoped and IPv4-mapped IPv6 addresses, and check that scoped addresses with specified non-ASCII zone identifier characters produce action issues.
Suggested reviewers: fabian-hiller
Merge Risk: Minimal · up to 1673b
This change makes IPv6 and IP validation reject non-ASCII zone identifier characters that were previously accepted through Unicode case folding. ASCII addresses keep matching, and the added tests cover the scoped, IPv4-mapped and non-ASCII cases. No merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: IP and IPv6 validation will reject non-ASCII characters that Unicode case folding accepts. The raw summary and PR objectives agree. The regex changes replace the lower…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: IP and IPv6 validation will reject non-ASCII characters that Unicode case folding accepts. The raw summary and PR objectives agree. The regex changes replace the lowercase-only classes plus the i flag with explicit upper- and lowercase ranges and the u flag. The tests add scoped and IPv4-mapped cases plus a failure case for non-ASCII zone identifiers. The title is clear, specific, and concise, and it follows the conventional commit style.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 39754c4a-b1f6-4efc-acf1-5bd6f9723960
Commits
Reviewing files that changed from the base of the PR and between 40fae94 and 1673b57.
Files selected for processing: 3
library/src/actions/ip/ip.test.ts
library/src/actions/ipv6/ipv6.test.ts
library/src/regex.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IPV6_REGEXandIP_REGEXused both theianduflags, so the zone ID character class matched U+017F (long s) and U+212A (Kelvin sign) via Unicode case folding (for example,fe80::1%\u017Fandfe80::1%\u212A).This spells out uppercase ASCII ranges explicitly and drops the
iflag (matching #1719 forbase64), keeping all ASCII IPv6/IP matching unchanged while rejecting non-ASCII zone ID characters.Summary by CodeRabbit