Skip to content

[cli-tools-test] Malformed domain names in firewall analysis when agent log uses quoted --allow-domains #24252

@github-actions

Description

@github-actions

Problem Description

The audit tool reports malformed domain names in firewall_analysis.blocked_domains when analyzing Codex runs. Domains appear with leading or trailing double-quote characters:

  • "*.githubusercontent.com (leading ")
  • chatgpt.com" (trailing ")

Command/Tool

  • Tool: audit
  • Affected function: extractFirewallFromAgentLog in pkg/cli/firewall_log.go

Steps to Reproduce

  1. Run a Codex workflow where the agent is blocked by the firewall with multiple domains
  2. The Codex CLI emits a warning in agent-stdio.log like:
    [WARN] To fix domain issues: --allow-domains "*.githubusercontent.com,...,chatgpt.com"
    
  3. Audit the run: the firewall_analysis.blocked_domains list will contain "*.githubusercontent.com and chatgpt.com" with spurious quote characters

Confirmed in run: §23934694474

Root Cause

In extractFirewallFromAgentLog (around line 470 of pkg/cli/firewall_log.go), the regex --allow-domains\s+([^\s]+) matches the entire token after --allow-domains, including surrounding double quotes when the argument is quoted.

For the log line:

--allow-domains "*.githubusercontent.com,...,chatgpt.com"

The capture group matches[1] = "*.githubusercontent.com,...,chatgpt.com" (including outer quotes).

When split by comma:

  • First element: "*.githubusercontent.com ← has leading "
  • Last element: chatgpt.com" ← has trailing "

The fix is to strip surrounding double quotes from matches[1] before splitting:

// Strip surrounding quotes if present (e.g., --allow-domains "dom1,dom2")
allowDomains := strings.Trim(matches[1], "\"")
for domain := range strings.SplitSeq(allowDomains, ",") {
    if d := strings.TrimSpace(domain); d != "" {
        blockedDomainsSet[d] = true
    }
}

Expected Behavior

blocked_domains should contain clean domain names without surrounding quote characters:

  • *.githubusercontent.com
  • chatgpt.com

Actual Behavior

blocked_domains contains:

  • "*.githubusercontent.com (leading ")
  • chatgpt.com" (trailing ")

Impact

  • Severity: Medium
  • Frequency: Always when a Codex workflow has multiple blocked domains and the agent emits the comma-separated --allow-domains warning with quotes
  • Workaround: None; the malformed domain names appear in audit reports and the MCP audit output

Additional Context

The audit recommendation for adding blocked domains to the workflow network.allowed list also includes these malformed entries, which would produce invalid YAML if copy-pasted:

network:
  allowed:
    - '"*.githubusercontent.com'  # ← invalid
    - 'chatgpt.com"'              # ← invalid

References: §23934694474

Generated by Daily CLI Tools Exploratory Tester · ● 2.1M ·

  • expires on Apr 10, 2026, 5:26 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions