Skip to content

Fix firewall analysis showing "-" instead of actual blocked domains for iptables-dropped traffic#20016

Merged
pelikhan merged 4 commits intomainfrom
copilot/fix-firewall-analysis-issue
Mar 8, 2026
Merged

Fix firewall analysis showing "-" instead of actual blocked domains for iptables-dropped traffic#20016
pelikhan merged 4 commits intomainfrom
copilot/fix-firewall-analysis-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

  • Fix pkg/cli/firewall_log.go - use destIPPort as fallback when domain is "-" (iptables-dropped traffic)
  • Fix actions/setup/js/parse_firewall_logs.cjs - same fallback logic in JS
  • Fix actions/setup/js/firewall_blocked_domains.cjs - same fallback logic in JS
  • Fix pkg/cli/logs_parsing_firewall.go - update inline JS to mirror parse_firewall_logs.cjs
  • Add TestParseFirewallLogIptablesDropped test in Go
  • Add "should use destIpPort as fallback when domain is placeholder" test in JS
  • Fix CI failure: capitalize Markdown in compile command Short description (cmd/gh-aw/main.go)
  • Fix CI failure: add global.core no-op mock in git_patch_integration.test.cjs so incremental mode tests that call generateGitPatch work outside of GitHub Actions environment

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…for iptables-dropped traffic

When iptables drops traffic before it reaches Squid proxy, the domain field
in the firewall log is \"-\" (unknown to Squid). However, the dest_ip:port
field still contains the actual destination IP address.

The fix uses destIPPort as a fallback identifier when domain is \"-\", so
blocked requests show their actual destination (e.g., \"8.8.8.8:53\",
\"1.2.3.4:443\") instead of grouping everything under \"-\".

Changes:
- pkg/cli/firewall_log.go: fallback to entry.DestIPPort when domain is \"-\"
- actions/setup/js/parse_firewall_logs.cjs: same fallback in JS
- actions/setup/js/firewall_blocked_domains.cjs: same fallback in JS
- pkg/cli/logs_parsing_firewall.go: same fallback in inline JS
- Tests: new TestParseFirewallLogIptablesDropped + JS test

Fixes #<issue>"

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix firewall analysis to show actual blocked domains Fix firewall analysis showing "-" instead of actual blocked domains for iptables-dropped traffic Mar 8, 2026
@pelikhan pelikhan marked this pull request as ready for review March 8, 2026 03:33
Copilot AI review requested due to automatic review settings March 8, 2026 03:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes firewall analysis/reporting so iptables-dropped traffic (where Squid logs domain="-") is attributed to the real destination using dest_ip:port as a fallback key.

Changes:

  • Use dest_ip:port as the domain key when domain === "-" in Go and JS firewall log parsers.
  • Apply the same fallback in the Actions step-summary parser and the inline JS used by the CLI.
  • Add/adjust tests to cover iptables-dropped scenarios and ensure blocked destinations are surfaced.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/cli/firewall_log.go Uses DestIPPort as the domain key when Domain == "-" during analysis.
pkg/cli/logs_parsing_firewall.go Mirrors the same fallback in the embedded JS used for generating firewall summaries.
actions/setup/js/parse_firewall_logs.cjs Uses destIpPort fallback when domain is a placeholder, improving step summary attribution.
actions/setup/js/firewall_blocked_domains.cjs Uses destIpPort fallback when domain is a placeholder for blocked domain extraction.
pkg/cli/firewall_log_test.go Adds a focused test validating iptables-dropped fallback behavior in Go parsing.
actions/setup/js/firewall_blocked_domains.test.cjs Expands tests to validate destIpPort fallback behavior for blocked domain extraction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@pelikhan
Copy link
Contributor

pelikhan commented Mar 8, 2026

…command Short description

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 8, 2026

@copilot Fix https://github.com/github/gh-aw/actions/runs/22811600503/job/66173340171

Fixed in 4268ba3. The CI failure was TestTechnicalTermsCapitalization — the compile command's Short description had lowercase markdown instead of Markdown. Changed "Compile workflow markdown files (.md)...""Compile workflow Markdown files (.md)...".

@pelikhan
Copy link
Contributor

pelikhan commented Mar 8, 2026

…g global.core mock

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 8, 2026

@copilot Fix https://github.com/github/gh-aw/actions/runs/22813218850/job/66173720496

Fixed in 747aa11. The 4 failing tests were in git_patch_integration.test.cjsincremental mode describe block. They call generateGitPatch, which uses execGitSync from git_helpers.cjs, which calls core.debug/core.error as GitHub Actions globals. The test file had no global.core mock, causing ReferenceError: core is not defined — caught silently and returning success: false. Added a no-op global.core mock (using vi.fn()) at the top of the file, matching the pattern used in other test files.

@pelikhan pelikhan merged commit 5482918 into main Mar 8, 2026
80 checks passed
@pelikhan pelikhan deleted the copilot/fix-firewall-analysis-issue branch March 8, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cli-tools-test] Firewall analysis shows "-" instead of actual blocked domain for all blocked requests

3 participants