noise: reject non-HEAD on PingResponseHandler
chi routes only HEAD to the handler, but assert explicitly so a future router config change cannot silently accept GET/POST and leak latency bytes or side-effects. Updates #3157
This commit is contained in:
parent
f3eb9a7bba
commit
5a7cafdf85
2 changed files with 37 additions and 0 deletions
|
|
@ -302,6 +302,11 @@ func (h *Headscale) PingResponseHandler(
|
|||
writer http.ResponseWriter,
|
||||
req *http.Request,
|
||||
) {
|
||||
if req.Method != http.MethodHead {
|
||||
http.Error(writer, "method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
pingID := req.URL.Query().Get("id")
|
||||
if pingID == "" {
|
||||
http.Error(writer, "missing ping ID", http.StatusBadRequest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue