feat: add rate limiting and job queue depth cap (closes #15)
- Add custom RateLimitMiddleware using governor crate for per-IP rate limiting - Two-tier rate limiting: destructive (20 req/min, burst 10) and read (120 req/min, burst 30) - Health endpoints (/health, /api/v1/system/info) exempt from rate limiting - Add max_queue_depth to JobManager (default: 100, configurable via config.yaml) - Return 429 Too Many Requests with Retry-After header when queue is full - Add RateLimitConfig to config.yaml with all rate limit settings - Add 10 tests covering rate limiting, queue depth, and configuration defaults
This commit is contained in:
@ -16,6 +16,9 @@ actix-web-actors = "4"
|
||||
actix = "0.13"
|
||||
actix-tls = { version = "3", features = ["rustls-0_23"] }
|
||||
|
||||
# Rate limiting (actix-governor for per-IP rate limiting)
|
||||
actix-governor = "0.6"
|
||||
|
||||
# Async runtime
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
@ -118,6 +121,10 @@ path = "tests/e2e/test_enrollment_e2e.rs"
|
||||
name = "auth_test"
|
||||
path = "tests/integration/auth_test.rs"
|
||||
|
||||
[[test]]
|
||||
name = "rate_limit_test"
|
||||
path = "tests/unit/rate_limit_test.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "api_benchmarks"
|
||||
harness = false
|
||||
|
||||
Reference in New Issue
Block a user