-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Is this a support request?
- This is not a support request
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
First off, love Headscale, it works great!
I think I found a bug in hostname handling.
When a client reports a hostname like "My-PC!", it fails ValidateHostname() and gets replaced with "invalid-xyz". Headscales code has a NormaliseHostname() function that would sanitize this to "my-pc".
The affected code paths are:
- ApplyHostnameFromHostInfo() hscontrol/types/node.go
- EnsureHostname() in hscontrol/util/util.go
Both use ValidateHostname() (reject if invalid), instead of NormaliseHostname() (sanitize and accept).
This seems like an oversight? The NormaliseHostname function exists but isn't being used.
Expected Behavior
Expected: Hostname "My-PC!" → sanitized to "my-pc"
Actual: Hostname "My-PC!" → rejected, becomes "invalid-abc123"
Steps To Reproduce
- Register a node with hostname containing invalid characters:
On client with hostname "My-PC!"
tailscale up --login-server https://your-headscale-server
-
List nodes on server:
headscale nodes list -
Expected: Node appears as my-pc
-
Actual: Node appears as invalid-abc123
Environment
- Headscale version: v0.27.1
- Deployment: Docker
- OS: Ubuntu 24.04.3 LTS
- Docker: 29.0.2Runtime environment
- Headscale is behind a (reverse) proxy
- Headscale runs in a container
Debug information
This is a code logic issue, so dont believe debug log is useful.