Skip to content

fix: allow single-label domains as network resources#670

Open
Squiddim wants to merge 1 commit into
netbirdio:mainfrom
Squiddim:fix/allow-single-label-domain-resources
Open

fix: allow single-label domains as network resources#670
Squiddim wants to merge 1 commit into
netbirdio:mainfrom
Squiddim:fix/allow-single-label-domain-resources

Conversation

@Squiddim

@Squiddim Squiddim commented Jun 15, 2026

Copy link
Copy Markdown

Remove the explicit dot requirement in ResourceSingleAddressInput.
The backend accepts single-label domains (e.g. 'service') since v0.71.0 via netbirdio/netbird#5211, but the UI was blocking them with a hardcoded !value.includes('.') check.

If you want to verify that the backend already accepted them:

curl -X POST https://<YOUR_MANAGEMENT_HOST>/api/networks/<NETWORK_ID>/resources \
   -H "Authorization: Token <YOUR_PAT_TOKEN>" \
   -H "Content-Type: application/json" \
   -d '{
     "name": "yeet-test",
     "address": "yeet",
     "groups": ["<YOUR_GROUP_ID>"],
     "enabled": true
   }'

use case(if needed): container setups where netbird & applications are in one network, allowing single-label domains allows one to talk to the application containers via their container name (internal DNS)

Issue ticket number and link

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

not needed as the functionality was already there beforehand

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes
    • Improved domain validation logic to more accurately detect valid domains during network resource input.
    • Updated domain validation error message to provide clearer guidance on accepted domain formats.

Remove the explicit dot requirement in ResourceSingleAddressInput.
The backend accepts single-label domains (e.g. 'service') since v0.71.0
via netbirdio/netbird#5211, but the UI was blocking them with a hardcoded
!value.includes('.') check.
Copilot AI review requested due to automatic review settings June 15, 2026 16:04

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Relaxes domain validation rules for the single-address input and updates the corresponding error message to reflect newly accepted formats.

Changes:

  • Removes the “must contain a dot” domain requirement.
  • Simplifies the invalid-domain condition to rely on validator.isValidDomain() plus a trailing-dot check.
  • Updates the error message examples to include single-label names (e.g., service).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/networks/resources/ResourceSingleAddressInput.tsx
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

In ResourceSingleAddressInput, the domain-validation branch no longer requires the input to contain "." before triggering a domain error. It now fires whenever validator.isValidDomain(value) returns false or the value ends with ".". The domain error message text is also updated.

Changes

Domain Validation Condition Fix

Layer / File(s) Summary
Domain validation condition and error message
src/modules/networks/resources/ResourceSingleAddressInput.tsx
Removes the value.includes(".") guard from the domain-error branch; the error now fires on !validator.isValidDomain(value) or a trailing dot alone. Updates the error message to reflect accepted input examples.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 A dot once demanded its presence in line,
But the rabbit said "No, that condition's not fine!"
Now domains stand alone without needing a .,
The validator judges them fair on their own.
Hop hop — one small fix, and the logic shines bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: allowing single-label domains as network resources, which matches the PR's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description check ✅ Passed The PR description follows the template structure with Issue ticket section and Documentation selection checkbox completed with explanation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant

CLAassistant commented Jun 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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