From 5da3c84bce5eb0ad557dba95e6acbf5d14c36739 Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 15 Feb 2023 12:58:59 -0500 Subject: [PATCH] feat(api): block empty user-agents --- services/web-proxy/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/web-proxy/main.go b/services/web-proxy/main.go index 6135a52f..2ff9c74d 100644 --- a/services/web-proxy/main.go +++ b/services/web-proxy/main.go @@ -48,6 +48,12 @@ func init() { type ProxyHandler struct{} func (p ProxyHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + if r.Header.Get("User-Agent") == "" { + // please set a valid user-agent + rw.WriteHeader(403) + return + } + remote, ok := remotes[r.Host] if !ok { // unknown domains redirect to landing page