fix: firewall log parser incorrectly skipping blocked requests#4781
Merged
fix: firewall log parser incorrectly skipping blocked requests#4781
Conversation
The parseFirewallLogLine() function was using overly-strict regex validation that rejected valid Squid log entries for blocked requests. Root cause: Blocked requests have "-:-" in the destIpPort field (no backend resolved), but the regex only accepted "-" or "IP:port" format. Changes: - Simplified parseFirewallLogLine() to remove fragile regex validations - Now only validates timestamp (essential for log format detection) - Relies on isRequestAllowed() for robust classification logic Impact: - Before: Job summaries showed "No blocked requests detected" even when firewall was blocking domains - After: Blocked domains (example.com, google.com, etc.) are correctly detected and reported The permissive parsing is safe because isRequestAllowed() provides secondary validation and defaults to "denied" for unknown patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where the firewall log parser was incorrectly skipping all blocked requests. The root cause was overly-strict regex validation that rejected valid Squid log entries where blocked requests have -:- in the destIpPort field (indicating no backend was resolved). The solution simplifies the parsing logic to only validate the timestamp, relying on the existing isRequestAllowed() function for robust request classification.
Key changes:
- Removed fragile field-level regex validations (client IP, domain, dest IP, status, decision)
- Retained essential validation (timestamp format, minimum field count)
- Changed userAgent parsing to normalize empty strings to
"-"
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pkg/workflow/js/parse_firewall_logs.cjs |
Simplified parseFirewallLogLine() by removing field-specific regex validations and relying on timestamp + field count checks |
.github/workflows/*.lock.yml (18 files) |
Auto-generated workflow files reflecting the bundled JavaScript changes from the source file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Jiaxiao (mossaka) Zhou <duibao55328@gmail.com>
Contributor
|
✅ Agentic Changeset Generator completed successfully. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The firewall log parser was silently skipping all blocked requests, causing job summaries to show "No blocked requests detected" even when the firewall was actively blocking domains.
Root cause: The
parseFirewallLogLine()function used overly-strict regex validation that rejected valid Squid log entries for blocked requests. Specifically, blocked requests have-:-in thedestIpPortfield (no backend resolved), but the regex only accepted-orIP:portformat.Evidence
From the firewall escape test run (https://github.com/githubnext/gh-aw/actions/runs/19682136498):
403 TCP_DENIEDstatus with-:-in destIpPort fieldSolution
Simplified
parseFirewallLogLine()by removing fragile regex validations:isRequestAllowed()for robust classification logicisRequestAllowed()defaults to "denied" for unknown patternsImpact
Testing
Verified both formats parse correctly:
1764100122.567 172.30.0.20:36586 api.github.com:443 140.82.116.6:443 1.1 CONNECT 200 TCP_TUNNEL:HIER_DIRECT1764100149.267 172.30.0.20:35642 example.com:443 -:- 1.1 CONNECT 403 TCP_DENIED:HIER_NONEReviewed by subagent - confirmed changes are correct and safe.
Files Changed
pkg/workflow/js/parse_firewall_logs.cjs(source).lock.ymlworkflow filesFixes the issue discovered in #4769