Skip to content

Commit

Permalink
Make IPAccessControlDisabled precede over EnableIpWhiteListing and En…
Browse files Browse the repository at this point in the history
…ableIpBlackListing
  • Loading branch information
jeffy-mathew committed Jan 10, 2025
1 parent c8f4065 commit 79b4037
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gateway/mw_ip_blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func (i *IPBlackListMiddleware) Name() string {
}

func (i *IPBlackListMiddleware) EnabledForSpec() bool {
if i.Spec.APIDefinition.IPAccessControlDisabled {
if !(!i.Spec.APIDefinition.IPAccessControlDisabled || i.Spec.APIDefinition.EnableIpBlacklisting) {
return false
}

return i.Spec.EnableIpBlacklisting && len(i.Spec.BlacklistedIPs) > 0
return len(i.Spec.APIDefinition.BlacklistedIPs) > 0
}

// ProcessRequest will run any checks on the request on the way through the system, return an error to have the chain fail
Expand Down
4 changes: 2 additions & 2 deletions gateway/mw_ip_whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func (i *IPWhiteListMiddleware) Name() string {
}

func (i *IPWhiteListMiddleware) EnabledForSpec() bool {
if i.Spec.APIDefinition.IPAccessControlDisabled {
if !(!i.Spec.APIDefinition.IPAccessControlDisabled || i.Spec.APIDefinition.EnableIpWhiteListing) {
return false
}

return i.Spec.APIDefinition.EnableIpWhiteListing && len(i.Spec.APIDefinition.AllowedIPs) > 0
return len(i.Spec.APIDefinition.AllowedIPs) > 0
}

// ProcessRequest will run any checks on the request on the way through the system, return an error to have the chain fail
Expand Down

0 comments on commit 79b4037

Please sign in to comment.