Skip to content

Commit

Permalink
fix HeaderValue match, Merge branch 'fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyale committed Sep 8, 2021
2 parents ac4ecf7 + d467ed3 commit c8878e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firewall/group_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func UpdateGroupPolicy(r *http.Request, userID int64, clientIP string, authUser
}

// IsMatchGroupPolicy ...
func IsMatchGroupPolicy(hitValueMap *sync.Map, appID int64, value string, checkPoint models.ChkPoint, designatedKey string, needDecode bool) (bool, *models.GroupPolicy) {
func IsMatchGroupPolicy(hitValueMap *sync.Map, appID int64, value string, checkPoint models.ChkPoint, headerKey string, needDecode bool) (bool, *models.GroupPolicy) {
if len(value) == 0 && checkPoint != models.ChkPointReferer {
// Exclude referer, because some cases require that Referer exists, such as CSRF detection
return false, nil
Expand All @@ -361,7 +361,7 @@ func IsMatchGroupPolicy(hitValueMap *sync.Map, appID int64, value string, checkP
continue
}
if groupPolicy.AppID == 0 || groupPolicy.AppID == appID {
if len(designatedKey) > 0 && (checkItem.KeyName != designatedKey) {
if len(checkItem.KeyName) > 0 && (checkItem.KeyName != headerKey) {
continue
}
hit := false
Expand Down

0 comments on commit c8878e4

Please sign in to comment.