Fix domain/hostname generation to comply with RFC 1123 - #1901
Merged
Conversation
PR Summary
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1901 +/- ##
============================================
- Coverage 92.56% 92.31% -0.26%
- Complexity 3573 3598 +25
============================================
Files 347 348 +1
Lines 7052 7115 +63
Branches 675 695 +20
============================================
+ Hits 6528 6568 +40
- Misses 365 375 +10
- Partials 159 172 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kingthorin
force-pushed
the
company-name-domains
branch
2 times, most recently
from
August 19, 2026 22:29
f43fc84 to
aa15f79
Compare
Addresses issues from PR datafaker-net#1757 where invalid domain names were being generated, particularly affecting non-ASCII locales and special characters in company names. Problems fixed: - Ampersands and special characters in company names now properly sanitized - Non-ASCII locales now generate valid ASCII hostnames (via Punycode) - Raw Unicode characters no longer leak into URLs - Invalid Punycode output eliminated Solution: - New HostnameHelper class enforces RFC 1123 LDH (Letter-Digit-Hyphen) rules - All domain generation methods now route through the sanitizer - FakerIDN guarantees valid ASCII output, never throws exceptions - Domain suffixes are also sanitized to handle locale-specific TLDs All generated domains are now valid for use with java.net.URL/URI constructors and conform to standard DNS hostname requirements. This is a hardening fix with no breaking changes to the public API. Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
kingthorin
force-pushed
the
company-name-domains
branch
from
August 19, 2026 23:35
aa15f79 to
5c0721a
Compare
Collaborator
Author
|
Sorry about the churn, it's now ready for review. |
asolntsev
approved these changes
Aug 20, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to PR #1757 where invalid domain names were being generated, particularly affecting non-ASCII locales and special characters in company names.
Problems fixed:
Solution:
All generated domains are now valid for use with java.net.URL/URI constructors, support multi-label TLDs, and properly handle international domain names via Punycode.
This is a hardening fix with no breaking changes to the public API.
Full disclosure
Claude code was leveraged in part during preparation of this PR.