Skip to content

DIFC/CLI proxy steps start gh-aw-mcpg by mutable tag while the gateway uses the digest pin #73572

Done

Description

@wolfgangcolsman

Summary

The DIFC proxy step (and the CLI proxy step) start the gh-aw-mcpg container by its mutable tag, although the compiler already resolves a digest pin for the same image and uses it for the MCP gateway. The proxy step receives GH_TOKEN (the GitHub MCP server token), so a moved tag would run different code with that token without any change to the compiled lock file.

Same class of defect as #51248 (tag-only gh-aw-firewall images), for the MCP gateway image used in proxy mode.

Observed (gh-aw v0.92.0)

Workflow with tools.github.min-integrity: approved and a custom pre-agent step that uses GH_TOKEN. The compiled lock file contains:

# manifest header
#   - ghcr.io/github/gh-aw-mcpg:v0.4.31@sha256:dbec0f2ddef6adf83b7764019323096e3e5cc0f3886255f6320555b7fe2a7caf

      - name: Start DIFC Proxy
        env:
          GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
          ...
          DIFC_PROXY_POLICY: '{"allow-only":{"min-integrity":"approved","repos":"all"}}'
          DIFC_PROXY_IMAGE: 'ghcr.io/github/gh-aw-mcpg:v0.4.31'
        run: |
          bash "${RUNNER_TEMP}/gh-aw/actions/start_difc_proxy.sh"

Download container images and MCP_GATEWAY_DOCKER_COMMAND later in the same job use ghcr.io/github/gh-aw-mcpg:v0.4.31@sha256:dbec0f2d…. The proxy starts before that download step, so the tag is what actually runs.

Root cause

pkg/workflow/compiler_difc_proxy.go (identical on v0.92.0 and main):

func resolveProxyContainerImage(gatewayConfig *MCPGatewayRuntimeConfig) string {
	version := gatewayConfig.Version
	if version == "" {
		version = string(constants.DefaultMCPGatewayVersion)
	}
	return gatewayConfig.Container + ":" + version
}

It never applies the container pins. The gateway path in pkg/workflow/mcp_setup_gateway.go (buildMCPGatewayContainerCommand) builds the same container:version string and then calls resolveContainerImage(containerImage, workflowData), which yields the @sha256: reference. resolveProxyContainerImage is used by both buildStartDIFCProxyStepYAML (DIFC_PROXY_IMAGE) and buildStartCliProxyStepYAML (CLI_PROXY_IMAGE).

Also note the version fallback differs: the gateway uses effectiveMCPGatewayVersion(workflowData), the proxy uses constants.DefaultMCPGatewayVersion.

Proposed fix (agentic plan)

  1. pkg/workflow/compiler_difc_proxy.go: change resolveProxyContainerImage to take data *WorkflowData, build the image exactly like buildMCPGatewayContainerCommand (Container + ":" + Version, falling back to effectiveMCPGatewayVersion(data)), and return resolveContainerImage(image, data). Update both callers (buildStartDIFCProxyStepYAML, buildStartCliProxyStepYAML).
  2. Tests (pkg/workflow/compiler_difc_proxy_test.go):
    • With a container pin for the gateway image in the action cache, DIFC_PROXY_IMAGE and CLI_PROXY_IMAGE equal the gateway's pinned reference (…:vX@sha256:…).
    • Without a pin, the value stays container:version (unchanged behaviour).
    • The proxy image equals the image in MCP_GATEWAY_DOCKER_COMMAND of the same lock file.
  3. Recompile the repository's own lock files and check that no DIFC_PROXY_IMAGE/CLI_PROXY_IMAGE value lacks @sha256: when the gateway image is pinned.
  4. Optionally extend the lock-file audit that records container_pin_not_found for firewall images (gh-aw-firewall/{agent,api-proxy,squid} emitted tag-only in v0.86.1 lock files (regression of #43307 / #38561) #51248) to flag any tag-only image passed to a step that also receives a token.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions