internal/middleware: return status 403 for denied teeproxy requests
When a request is made by the teeproxy to pkg.go.dev and the
teeproxy-traffic experiment flag is off, return a status 403.
Updates b/147492597
CI-Result: Cloud Build
@@ -53,6 +53,7 @@ func Experiment(e *Experimenter) Middleware {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r2 := e.setExperimentsForRequest(r)
if r2.Referer() == teeproxyURL && !experiment.IsActive(r2.Context(), "teeproxy-traffic") {
+ w.WriteHeader(http.StatusForbidden)
return
}
h.ServeHTTP(w, r2)
