Skip to content

Restrict legacy credential-backed proxy ingress - #76957

Closed
pelikhan wants to merge 1 commit into
mainfrom
pelikhan/ai-scan-proxy-access
Closed

pelikhan wants to merge 1 commit into
mainfrom
pelikhan/ai-scan-proxy-access

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Legacy host-network DIFC and CLI proxies exposed token-backed GitHub access to other machines that could reach the runner's listener (AI Scan alerts 1095 and 1096).

  • Bind the pre-agent DIFC proxy to loopback in host-network mode, preserving the isolated bridge listener and loopback publication.
  • Install a fail-closed INPUT filter before launching the legacy CLI proxy. Preserve host and Docker bridge connectivity while rejecting other ingress, including routed requests to the Docker gateway address.
  • Determine cleanup behavior from the actual container network mode. Remove only owned firewall rules after stopping the host-network listener; retain restrictive rules when the container is already absent.

The default isolated topology and compiler output are unchanged. Host processes and Docker-standard docker0/br-* interfaces remain trusted; nonstandard bridge-interface names are not exceptions. Alert 1097 is not treated as an authentication bypass: the MCP HTTP binding is retained for gateway compatibility, with valid, missing, and incorrect API keys checked across interfaces.

Validation

  • make agent-report-progress passed: build, JavaScript lint/typecheck, shell checks, and 51 proxy startup/lifecycle tests.
  • Existing MCP HTTP runner suite: 30 passing tests.
  • bash actions/setup/sh/proxy_network_test.sh passed in an isolated Linux Docker fixture using real iptables and network namespaces: legacy connectivity, external rejection, retry/scoped cleanup, DIFC loopback, and MCP authentication.

JavaScript tests ran on Linux Node 24 through a session-local wrapper because the existing FIFO diagnostic capture stalls on macOS. CLI/DIFC network checks use a synthetic HTTP listener, not a live GitHub token or a complete AWF/MCPG deployment.

@pelikhan
pelikhan marked this pull request as ready for review November 12, 2026 02:09
Copilot AI adaptive review requested due to automatic review settings November 12, 2026 02:09
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76957

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76957

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from PR Code Quality Reviewer · gpt56 · ~8 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-12T02:20:00Z
review_event: COMMENT
top_themes:
  - stale firewall filter after failed legacy proxy startup
files_reviewed:
  - actions/setup/js/start_cli_proxy.test.cjs
  - actions/setup/sh/proxy_network_lib.sh
  - actions/setup/sh/proxy_network_test.sh
  - actions/setup/sh/start_cli_proxy.sh
  - actions/setup/sh/start_difc_proxy.sh
  - actions/setup/sh/stop_cli_proxy.sh
  - docs/src/content/docs/reference/integrity.md
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~8 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review summary

One medium-severity lifecycle issue: failed legacy proxy startup can leave a stale host firewall filter on port 18443. The new ingress protection is otherwise appropriately fail-closed, and I found no additional actionable issues in the changed lines.

Details
  • Ensure startup failures clean up or explicitly manage ownership of the installed filter so self-hosted runners do not retain unexplained state indefinitely.
  • The broad Docker bridge trust and loopback binding match the documented topology assumptions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~8 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

DOCKER_NETWORK_ARGS=(--network bridge -p 127.0.0.1:18443:18443)
else
# shellcheck source=proxy_network_lib.sh
source "${SCRIPT_DIR}/proxy_network_lib.sh"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Installing the host ingress filter before docker run can leave a stale filter behind whenever container creation or either readiness check fails, because the failure paths remove the container and stop_cli_proxy.sh intentionally retains the filter when no container exists.

💡 Clean up failed startup state

Please add an EXIT/ERR cleanup path after the filter is installed (or track ownership/state) so failed starts do not leave port 18443 filtered indefinitely on self-hosted runners; otherwise later jobs can inherit unexplained firewall state and lose connectivity.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The firewall can expose the credential-backed proxy through IPv6 or unintended bridges while blocking legitimate legacy sidecar traffic.

4 open issues
What changed in this PR

This PR adds ingress controls to gh-aw’s legacy credential-backed proxies while leaving compiler output and the default isolated topology unchanged.

Changes:

  • Bind the host-network DIFC proxy to loopback and require firewall installation before starting the legacy CLI proxy.
  • Base cleanup on the container’s actual network mode, stopping the listener before removing its filter.
  • Add lifecycle and network coverage, and document the fallback trust boundary.
File Description
docs/​src/​content/​docs/​reference/​integrity.md Documents legacy ingress restrictions and cleanup behavior.
actions/​setup/​sh/​stop_cli_proxy.sh Checks network mode and stops the container before filter removal.
actions/​setup/​sh/​start_difc_proxy.sh Selects loopback or bridge listening based on isolation mode.
actions/​setup/​sh/​start_cli_proxy.sh Gates host-network startup on ingress-filter installation.
actions/​setup/​sh/​proxy_network_test.sh Adds network-namespace connectivity, rejection, and authentication checks.
actions/​setup/​sh/​proxy_network_lib.sh Implements reusable ingress-filter installation and removal.
actions/​setup/​js/​start_cli_proxy.test.cjs Covers binding, firewall failures, and shutdown ordering.

Review effort: Max (auto)

# Install the deny before any exceptions or INPUT hook. Retries are idempotent.
sudo -n iptables -w -C GH_AW_CLI_PROXY -j DROP 2>/dev/null ||
sudo -n iptables -w -A GH_AW_CLI_PROXY -j DROP || return 1
for interface in lo docker0 br-+; do
# Install the deny before any exceptions or INPUT hook. Retries are idempotent.
sudo -n iptables -w -C GH_AW_CLI_PROXY -j DROP 2>/dev/null ||
sudo -n iptables -w -A GH_AW_CLI_PROXY -j DROP || return 1
for interface in lo docker0 br-+; do
sudo -n iptables -w -I GH_AW_CLI_PROXY 1 -i "$interface" -j RETURN || return 1
done
sudo -n iptables -w -C INPUT -p tcp --dport 18443 -j GH_AW_CLI_PROXY 2>/dev/null ||
sudo -n iptables -w -I INPUT 1 -p tcp --dport 18443 -j GH_AW_CLI_PROXY || return 1
Comment on lines +23 to +35
cleanup() {
if [ -n "$SERVER_PID" ]; then kill "$SERVER_PID" 2>/dev/null || true; fi
if [ -n "$MCP_PID" ]; then kill "$MCP_PID" 2>/dev/null || true; fi
for namespace in external sidecar isolated; do
ip netns delete "$namespace" 2>/dev/null || true
done
}
trap cleanup EXIT

ip link set lo up
for entry in external:eth0:192.0.2 sidecar:docker0:172.18.0 isolated:br-awf-test:172.19.0; do
IFS=: read -r namespace interface subnet <<< "$entry"
ip netns add "$namespace"
@github-actions

Copy link
Copy Markdown
Contributor

Triage

  • Category: bug
  • Risk: high
  • Score: 81/100 (impact 42 + urgency 23 + quality 16)
  • Recommended action: fast_track
  • Batch: deps-2026-11-16 (not applicable; security fix)
  • Notes: security-sensitive ingress change; close human review is warranted.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.3K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug
Risk: high
Total score: 81/100
Score breakdown: impact 44 + urgency 24 + quality 13 = 81
Recommended action: fast_track
Batch: none

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~6 AIC · ⌖ ~2 AIC · ⊞ 15.3K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: high | Total score: 81 (impact 0/urgency 0/quality 0) | Recommended action: fast_track | Batch: none

PR: #76957 — Restrict legacy credential-backed proxy ingress

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~7 AIC · ⌖ ~2 AIC · ⊞ 15.3K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: high | Total score: 81/100 | Breakdown: impact 45, urgency 24, quality 12 | Recommended action: fast_track | Batch: security-review

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~5 AIC · ⌖ ~2 AIC · ⊞ 15.2K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants