isRequestAllowed determines if a request was allowed based on decision and status This mirrors the logic from the JavaScript parser
(decision, status string)
| 242 | // isRequestAllowed determines if a request was allowed based on decision and status |
| 243 | // This mirrors the logic from the JavaScript parser |
| 244 | func isRequestAllowed(decision, status string) bool { |
| 245 | // Check status code first |
| 246 | if statusCode, err := strconv.Atoi(status); err == nil { |
| 247 | if statusCode == http.StatusOK || statusCode == http.StatusPartialContent || statusCode == http.StatusNotModified { |
| 248 | return true |
| 249 | } |
| 250 | if statusCode == http.StatusForbidden || statusCode == http.StatusProxyAuthRequired { |
| 251 | return false |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | // Check decision field |
| 256 | if strings.Contains(decision, "TCP_TUNNEL") || |
| 257 | strings.Contains(decision, "TCP_HIT") || |
| 258 | strings.Contains(decision, "TCP_MISS") { |
| 259 | return true |
| 260 | } |
| 261 | |
| 262 | if strings.Contains(decision, "NONE_NONE") || |
| 263 | strings.Contains(decision, "TCP_DENIED") { |
| 264 | return false |
| 265 | } |
| 266 | |
| 267 | // Default to denied for safety |
| 268 | return false |
| 269 | } |
| 270 | |
| 271 | // parseFirewallLog parses a firewall log file and returns analysis |
| 272 | func parseFirewallLog(logPath string, verbose bool) (*FirewallAnalysis, error) { |
no outgoing calls