Skip to content

Commit

Permalink
Merge pull request #181 from croessner/features
Browse files Browse the repository at this point in the history
Fix: Reorder whitelist checks for brute force protection.
  • Loading branch information
croessner authored Dec 3, 2024
2 parents 8bdd3db + a4cb884 commit 794cc82
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/core/bruteforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,19 +1010,19 @@ func (a *AuthState) CheckBruteForce() (blockClientIP bool) {
return false
}

if len(config.LoadableConfig.BruteForce.IPWhitelist) > 0 {
if a.IsInNetwork(config.LoadableConfig.BruteForce.IPWhitelist) {
if config.LoadableConfig.BruteForce.HasSoftWhitelist() {
if util.IsSoftWhitelisted(a.Username, a.ClientIP, *a.GUID, config.LoadableConfig.BruteForce.SoftWhitelist) {
a.AdditionalLogs = append(a.AdditionalLogs, definitions.LogKeyBruteForce)
a.AdditionalLogs = append(a.AdditionalLogs, definitions.Whitelisted)
a.AdditionalLogs = append(a.AdditionalLogs, definitions.SoftWhitelisted)

return false
}
}

if config.LoadableConfig.BruteForce.HasSoftWhitelist() {
if util.IsSoftWhitelisted(a.Username, a.ClientIP, *a.GUID, config.LoadableConfig.BruteForce.SoftWhitelist) {
if len(config.LoadableConfig.BruteForce.IPWhitelist) > 0 {
if a.IsInNetwork(config.LoadableConfig.BruteForce.IPWhitelist) {
a.AdditionalLogs = append(a.AdditionalLogs, definitions.LogKeyBruteForce)
a.AdditionalLogs = append(a.AdditionalLogs, definitions.SoftWhitelisted)
a.AdditionalLogs = append(a.AdditionalLogs, definitions.Whitelisted)

return false
}
Expand Down

0 comments on commit 794cc82

Please sign in to comment.