[MM-15639] Add config setting to explicitly define which IP headers are trusted (#10907)
* Add config setting to explicitly define which IP headers are trusted * fix variable shadowing * Optimize code flow; Add Ratelimit test for header set * Extend Ratelimit tests * Add additional unit tests * Structured logging
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e8af4872c6
Коммит
2d97f01781
@@ -226,6 +226,7 @@ type ServiceSettings struct {
|
||||
UseLetsEncrypt *bool `restricted:"true"`
|
||||
LetsEncryptCertificateCacheFile *string `restricted:"true"`
|
||||
Forward80To443 *bool `restricted:"true"`
|
||||
TrustedProxyIPHeader []string `restricted:"true"`
|
||||
ReadTimeout *int `restricted:"true"`
|
||||
WriteTimeout *int `restricted:"true"`
|
||||
MaximumLoginAttempts *int `restricted:"true"`
|
||||
@@ -434,6 +435,10 @@ func (s *ServiceSettings) SetDefaults() {
|
||||
s.Forward80To443 = NewBool(false)
|
||||
}
|
||||
|
||||
if s.TrustedProxyIPHeader == nil {
|
||||
s.TrustedProxyIPHeader = []string{HEADER_FORWARDED, HEADER_REAL_IP}
|
||||
}
|
||||
|
||||
if s.TimeBetweenUserTypingUpdatesMilliseconds == nil {
|
||||
s.TimeBetweenUserTypingUpdatesMilliseconds = NewInt64(5000)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user