MCPcopy Create free account
hub / github.com/github/gh-aw / isEntryAllowed

Function isEntryAllowed

pkg/cli/firewall_policy.go:236–255  ·  view source on GitHub ↗

isEntryAllowed determines the observed outcome of a request. This mirrors the classification logic used by the firewall log parser.

(entry AuditLogEntry)

Source from the content-addressed store, hash-verified

234// isEntryAllowed determines the observed outcome of a request.
235// This mirrors the classification logic used by the firewall log parser.
236func isEntryAllowed(entry AuditLogEntry) bool {
237 status := entry.Status
238 if status == http.StatusOK || status == http.StatusPartialContent || status == http.StatusNotModified {
239 return true
240 }
241 if status == http.StatusForbidden || status == http.StatusProxyAuthRequired {
242 return false
243 }
244 decision := entry.Decision
245 if strings.Contains(decision, "TCP_TUNNEL") ||
246 strings.Contains(decision, "TCP_HIT") ||
247 strings.Contains(decision, "TCP_MISS") {
248 return true
249 }
250 if strings.Contains(decision, "NONE_NONE") ||
251 strings.Contains(decision, "TCP_DENIED") {
252 return false
253 }
254 return false
255}
256
257// protocolMatches checks if a rule's protocol constraint matches the request.
258// "both" matches everything; "https" matches only HTTPS; "http" matches only HTTP.

Callers 4

TestIsEntryAllowedFunction · 0.85
findMatchingRuleFunction · 0.85
enrichWithPolicyRulesFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsEntryAllowedFunction · 0.68