Skip to content

fix(ip, ipv6): reject non-ASCII characters accepted by Unicode case folding - #1750

Open
hoanle0126 wants to merge 1 commit into
open-circle:mainfrom
hoanle0126:fix/ip-ipv6-unicode-case-folding
Open

hoanle0126 wants to merge 1 commit into
open-circle:mainfrom
hoanle0126:fix/ip-ipv6-unicode-case-folding

Conversation

@hoanle0126

@hoanle0126 hoanle0126 commented Nov 21, 2026 •

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

This branch has not been deployed

No deployments
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.

1 participant