feat(ops): protect metrics, rate-limit auth, agent secret timing, e2e smoke
CI / changes (push) Successful in 7s
CI / openapi (push) Failing after 40s
CI / web (push) Successful in 56s
CI / commitlint (push) Skipped
CI / go (push) Failing after 34s
CI / bird2 (push) Skipped
CI / release (push) Skipped

Bearer для /metrics (EVOBGP_METRICS_TOKEN); rate limit /v1/auth/config; constant-time agent secret; OTel stub; Playwright smoke; HTTP_PROXY note; checklist обновлён.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-07-31 12:29:00 +07:00
co-authored by Cursor
parent 26f5172f88
commit 6c6e76fca3
15 changed files with 224 additions and 6 deletions
+3 -1
View File
@@ -2,6 +2,7 @@ package agentserver
import (
"context"
"crypto/subtle"
"encoding/json"
"fmt"
"log"
@@ -157,7 +158,8 @@ func (s *Server) authorize(r *http.Request) bool {
if !strings.HasPrefix(h, prefix) {
return false
}
return strings.TrimSpace(h[len(prefix):]) == secret
got := strings.TrimSpace(h[len(prefix):])
return subtle.ConstantTimeCompare([]byte(got), []byte(secret)) == 1
}
func writeJSON(w http.ResponseWriter, status int, v any) {