From 489f13031b6c4bb0df1fb6f86df68387350738ae Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Wed, 7 May 2025 23:21:00 +0200 Subject: [PATCH] add limiter to the get all peers --- management/server/http/handlers/peers/peers_handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/management/server/http/handlers/peers/peers_handler.go b/management/server/http/handlers/peers/peers_handler.go index ca33c0d45..fdfcce261 100644 --- a/management/server/http/handlers/peers/peers_handler.go +++ b/management/server/http/handlers/peers/peers_handler.go @@ -203,6 +203,10 @@ func (h *Handler) HandlePeer(w http.ResponseWriter, r *http.Request) { // GetAllPeers returns a list of all peers associated with a provided account func (h *Handler) GetAllPeers(w http.ResponseWriter, r *http.Request) { + if !h.rateLimiter.Allow() { + util.WriteError(r.Context(), fmt.Errorf("temp rate limit reached"), w) + return + } userAuth, err := nbcontext.GetUserAuthFromContext(r.Context()) if err != nil { util.WriteError(r.Context(), err, w)