[misc] Add upload URL signing and rate limiting (#7502)

This commit is contained in:
Bethuel Mmbaga
2026-09-24 17:34:58 +03:00
committed by GitHub
parent 94106b57ab
commit 0a128cea6f
11 changed files with 488 additions and 47 deletions
+4 -2
View File
@@ -12,6 +12,8 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
log "github.com/sirupsen/logrus"
"github.com/netbirdio/netbird/management/server/http/middleware"
"github.com/netbirdio/netbird/upload-server/types"
)
@@ -21,7 +23,7 @@ type sThree struct {
presignClient *s3.PresignClient
}
func configureS3Handlers(mux *http.ServeMux) error {
func configureS3Handlers(mux *http.ServeMux, limiter *middleware.APIRateLimiter) error {
bucket := os.Getenv(bucketVar)
region, ok := os.LookupEnv("AWS_REGION")
if !ok {
@@ -40,7 +42,7 @@ func configureS3Handlers(mux *http.ServeMux) error {
bucket: bucket,
presignClient: s3.NewPresignClient(client),
}
mux.HandleFunc(types.GetURLPath, handler.handlerGetUploadURL)
mux.Handle(types.GetURLPath, limiter.Middleware(http.HandlerFunc(handler.handlerGetUploadURL)))
return nil
}