-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
component:ground-controlGround Control componentGround Control componentpriority:lowLow priority issueLow priority issue
Description
Problem
The rate limiter in ground-control/internal/middleware/ratelimit.go currently only uses r.RemoteAddr for client identification and ignores X-Forwarded-For headers. While this is secure against IP spoofing, it becomes problematic when Ground Control runs behind a reverse proxy (nginx, AWS ALB, K8s Ingress).
When behind a proxy, all requests appear to come from the proxy's IP, causing all clients to share the same rate limit bucket.
Current Behavior
func getClientIP(r *http.Request) string {
// Only use RemoteAddr - ignores X-Forwarded-For
host, _, err := net.SplitHostPort(r.RemoteAddr)
// ...
}Proposed Solution
Add configuration for trusted proxies:
- Add
TrustedProxies []stringconfiguration option - Only parse
X-Forwarded-Forwhen the immediate client is in the trusted list - Validate the header chain to prevent spoofing
Reference
- File:
ground-control/internal/middleware/ratelimit.go:106-115
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component:ground-controlGround Control componentGround Control componentpriority:lowLow priority issueLow priority issue
Type
Projects
Status
Backlog