[Bug] Internal server error on /verify #1085

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

Originally created by @nblock on GitHub (Aug 14, 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

An internal server error is displayed when non-JSON is sent to /verify.

Expected Behavior

Either respond with HTTP/400 BadRequest or HTTP/200 and {"Allow":false} when malformed request data is sent by a client.

Steps To Reproduce

  1. Compile main, currently 30cec3aa
  2. Send invalid requests with curl:
     curl $HEADSCALE_URL/verify -d ''
     curl $HEADSCALE_URL/verify -d 'a'
     curl $HEADSCALE_URL/verify -d '{'
    
  3. Observe logs from Headscale
    ERR http internal server error error="cannot parse derpAdmitClientRequest: unexpected end of JSON input" code=50
    ERR http internal server error error="cannot parse derpAdmitClientRequest: invalid character 'a' looking for beginning of value" code=500
    ERR http internal server error error="cannot parse derpAdmitClientRequest: unexpected end of JSON input" code=500
    

Environment

- OS:Debian 13
- Headscale version: main, 30cec3aa
- Tailscale version: -

Runtime environment

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

Debug information

Originally created by @nblock on GitHub (Aug 14, 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 An internal server error is displayed when non-JSON is sent to `/verify`. ### Expected Behavior Either respond with HTTP/400 BadRequest or HTTP/200 and `{"Allow":false}` when malformed request data is sent by a client. ### Steps To Reproduce 1. Compile main, currently 30cec3aa 2. Send invalid requests with curl: ```console curl $HEADSCALE_URL/verify -d '' curl $HEADSCALE_URL/verify -d 'a' curl $HEADSCALE_URL/verify -d '{' ``` 3. Observe logs from Headscale ```console ERR http internal server error error="cannot parse derpAdmitClientRequest: unexpected end of JSON input" code=50 ERR http internal server error error="cannot parse derpAdmitClientRequest: invalid character 'a' looking for beginning of value" code=500 ERR http internal server error error="cannot parse derpAdmitClientRequest: unexpected end of JSON input" code=500 ``` ### Environment ```markdown - OS:Debian 13 - Headscale version: main, 30cec3aa - Tailscale version: - ``` ### Runtime environment - [ ] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ### Debug information -
adam added the bugno-stale-bot labels 2025-12-29 02:28:11 +01:00
adam closed this issue 2025-12-29 02:28:11 +01:00
Author
Owner

@nblock commented on GitHub (Aug 14, 2025):

Sending valid JSON but with malformed values also triggers the error:

 curl $HEADSCALE_URL/verify --json '{"nodePublic": "nodekey:this-is-too-short", "source": "192.168.1.1"}'

Logs:

ERR http internal server error error="cannot parse derpAdmitClientRequest: key hex has the wrong size, got 17 want 64" code=500
@nblock commented on GitHub (Aug 14, 2025): Sending valid JSON but with malformed values also triggers the error: ```console curl $HEADSCALE_URL/verify --json '{"nodePublic": "nodekey:this-is-too-short", "source": "192.168.1.1"}' ``` Logs: ``` ERR http internal server error error="cannot parse derpAdmitClientRequest: key hex has the wrong size, got 17 want 64" code=500 ```
Author
Owner

@nblock commented on GitHub (Aug 18, 2025):

Fixed via 086fcad7d9

@nblock commented on GitHub (Aug 18, 2025): Fixed via 086fcad7d958e1f94b172e2dd25f89ccdc3e1955
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1085