Skip to content

fix: allow underscores in domain labels#2057

Open
lu-zero wants to merge 1 commit into
stacksjs:mainfrom
lu-zero:fix/allow-underscores-in-domain-labels
Open

fix: allow underscores in domain labels#2057
lu-zero wants to merge 1 commit into
stacksjs:mainfrom
lu-zero:fix/allow-underscores-in-domain-labels

Conversation

@lu-zero
Copy link
Copy Markdown

@lu-zero lu-zero commented Apr 24, 2026

Fixes #2056

The domain validation regex rejects underscores, preventing queries for DKIM, DMARC, SRV, and TLSA records which use underscore-prefixed labels (e.g., _dmarc.example.com, selector1._domainkey.example.com).

One-character fix: [a-z0-9-][a-z0-9_-] in validateDomainName.

Per RFC 2181 §11, any binary label up to 63 octets is valid in DNS. The no-underscore restriction is a hostname convention (RFC 952), not a DNS protocol requirement.

Added test covering DKIM, DMARC, and SRV domain patterns.

The domain validation regex `/^[a-z0-9-]+$/i` rejects underscores,
preventing queries for DKIM, DMARC, SRV, and TLSA records which
require underscore-prefixed labels (e.g., `_dmarc.example.com`).

Per RFC 2181 §11, any binary label up to 63 octets is valid in DNS.
The no-underscore restriction is a hostname convention, not a DNS
protocol requirement.

Fixes stacksjs#2056
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 24, 2026

Deploy Preview for dnsx ready!

Name Link
🔨 Latest commit 0292a54
🔍 Latest deploy log https://app.netlify.com/projects/dnsx/deploys/69eb122f9115200008b10f85
😎 Deploy Preview https://deploy-preview-2057--dnsx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Domain validation rejects underscores, breaking DKIM/DMARC/SRV queries

1 participant