Skip to content

Commit

Permalink
internal/appsec: pass htpt.client_ip address to the WAF
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellzy committed Oct 26, 2022
1 parent 6174747 commit a36fc28
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/appsec/waf.go
Expand Up @@ -145,6 +145,11 @@ func newHTTPWAFEventListener(handle *waf.Handle, addresses []string, timeout tim
}
case serverResponseStatusAddr:
values[serverResponseStatusAddr] = res.Status

case httpClientIP:
if args.ClientIP.IsValid() {
values[httpClientIP] = args.ClientIP.String()
}
}
}
matches := runWAF(wafCtx, values, timeout)
Expand Down Expand Up @@ -281,6 +286,7 @@ const (
serverRequestPathParams = "server.request.path_params"
serverRequestBody = "server.request.body"
serverResponseStatusAddr = "server.response.status"
httpClientIP = "http.client_ip"
)

// List of HTTP rule addresses currently supported by the WAF
Expand All @@ -292,6 +298,7 @@ var httpAddresses = []string{
serverRequestPathParams,
serverRequestBody,
serverResponseStatusAddr,
httpClientIP,
}

// gRPC rule addresses currently supported by the WAF
Expand Down

0 comments on commit a36fc28

Please sign in to comment.