feat(platform): trust X-Forwarded-For only from configured proxies

gin trusted every proxy by default, so any client could choose the
address used for rate limits and the audit log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 09:59:52 +01:00
1 parent bd986cd49f
commit 789ef077eb
6 files changed
+56

No files matched your search

+6
View File
@@ -27,6 +27,10 @@ type Common struct {
Edition Edition `env:"UPTIME_EDITION" envDefault:"selfhosted"`
LogLevel slog.Level `env:"UPTIME_LOG_LEVEL" envDefault:"info"`
ShutdownTimeout time.Duration `env:"UPTIME_SHUTDOWN_TIMEOUT" envDefault:"20s"`
// TrustedProxies are addresses or CIDRs of reverse proxies whose
// X-Forwarded-For is believed. Client addresses feed rate limits and
// the audit log, so the default trusts no proxy.
TrustedProxies []string `env:"UPTIME_TRUSTED_PROXIES" envSeparator:","`
}
// Storage locates Postgres and Redis. Only the API connects to them; every
@@ -100,6 +104,8 @@ type Retention struct {
Daily time.Duration `env:"UPTIME_RETENTION_DAILY" envDefault:"26280h"`
// Delivered notifications, expired invitations and expired API tokens.
Housekeeping time.Duration `env:"UPTIME_RETENTION_HOUSEKEEPING" envDefault:"720h"`
// Audit log entries.
Audit time.Duration `env:"UPTIME_RETENTION_AUDIT" envDefault:"8760h"`
}
// SSOAllowPrivate resolves SSOPrivateNetworks.