[Bug] Headscale API Bypasses Middleware Check #1115

Closed
opened 2025-12-29 02:28:20 +01:00 by adam · 0 comments
Owner

Originally created by @ElyasAsmad on GitHub (Oct 21, 2025).

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

In the latest build of headscale (main branch, commit 8becb7e54a), Headscale APIs bypasses middleware check and returns sensitive data even if the API caller does not provide any API key at all. Provided below are screenshots from my Postman and my Headscale logs:

Image

Expected Behavior

If an API caller does not provide any API key, Headscale should return 401 Unauthorized without returning any sensitive data. The request should be terminated inside the auth middleware.

Steps To Reproduce

  1. Clone and build the latest change from Headscale repository.
  2. Setup a simple configuration to make sure Headscale can run.
  3. Create some mock users, e.g: headscale users create elyasasmad.
  4. Run headscale serve.
  5. Run curl https://example.com/api/v1/user.
  6. Headscale users are returned after the Unauthorized text at the beginning of the response.

Environment

- OS: Ubuntu 25.04
- Headscale version: Commit 8becb7e54a6b565013aeff2feee5e5d639c564aa (v0.27.0-beta.1 shows the same behavior)
- Tailscale version: 1.88.3
- Number of nodes: 14

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Debug information

Image
Originally created by @ElyasAsmad on GitHub (Oct 21, 2025). ### Is this a support request? - [x] This is not a support request ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior In the latest build of headscale (main branch, commit 8becb7e54a6b565013aeff2feee5e5d639c564aa), Headscale APIs bypasses middleware check and returns sensitive data even if the API caller does not provide any API key at all. Provided below are screenshots from my Postman and my Headscale logs: <img width="1800" height="1169" alt="Image" src="https://github.com/user-attachments/assets/47d5466b-e04b-4963-90a7-ba2842369e00" /> ### Expected Behavior If an API caller does not provide any API key, Headscale should return 401 Unauthorized without returning any sensitive data. The request should be terminated inside the auth middleware. ### Steps To Reproduce 1. Clone and build the latest change from Headscale repository. 2. Setup a simple configuration to make sure Headscale can run. 3. Create some mock users, e.g: `headscale users create elyasasmad`. 4. Run `headscale serve`. 5. Run `curl https://example.com/api/v1/user`. 6. Headscale users are returned after the `Unauthorized` text at the beginning of the response. ### Environment ```markdown - OS: Ubuntu 25.04 - Headscale version: Commit 8becb7e54a6b565013aeff2feee5e5d639c564aa (v0.27.0-beta.1 shows the same behavior) - Tailscale version: 1.88.3 - Number of nodes: 14 ``` ### Runtime environment - [ ] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ### Debug information <img width="1793" height="508" alt="Image" src="https://github.com/user-attachments/assets/2fc14018-7073-4f67-b576-73c0b71dc17d" />
adam added the bug label 2025-12-29 02:28:20 +01:00
adam closed this issue 2025-12-29 02:28:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1115