Skip to content

agy: execute_bash strips CA bundle, spec.env, GIT_ASKPASS, and AX_METADATA_URL #35

Todo

Description

@mayawang

agy/worker.go forwards SSL_CERT_FILE and the task's environment (with Gemini/Google API credentials removed) to gemini-api environments connect, so the Go worker itself trusts AX's egress CA bundle. However, bash commands run by the agent through execute_bash run in an allowlisted environment that drops everything outside baseline OS and locale variables.

Root cause

In github.com/google-gemini/[email protected]:

  • internal/cli/custom/environments_runtime.go (newCLIPullWorker) creates envruntime.NewSandboxShell(absWork).
  • internal/cli/custom/envruntime/shell.go defaults EnvPolicy to EnvPolicyAllowlist, which runs BuildAllowlistEnv and retains only PATH, HOME, USER, LOGNAME, SHELL, LANG, TERM, TMPDIR, LC_*, and Windows baseline variables.

Impact inside AX sandboxes

  1. execute_bash commands fail TLS verification against any AX Gateway https: egress rule, because SSL_CERT_FILE, CURL_CA_BUNDLE, REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS, and GIT_SSL_CAINFO are stripped and /run/ate/egress-trust-bundle/trust-bundle.pem is not in the Debian system trust store.
  2. GIT_ASKPASS, GIT_TERMINAL_PROMPT, and AX_METADATA_URL are stripped, so git cannot use AX's askpass helper and bash tools cannot read AX_METADATA_URL.
  3. Any variables passed in Task.spec.env are invisible inside execute_bash.

Reproduced live with ax-antigravity + gemini-api v0.5.0 by running printenv SSL_CERT_FILE AX_TEST_ENV_VAR AX_METADATA_URL GIT_ASKPASS; echo DONE via execute_bash with all four set in the harness environment; all four printed empty.

Fix direction

envruntime in gemini-api-cli already implements EnvPolicyScrubCredentials, which keeps the process environment minus Gemini/Google credential variables, but envruntime is an internal package and environments connect / environments serve do not expose an --env-policy flag yet. Expose an env-policy flag upstream in google-gemini/gemini-api-cli and pass it from agy/worker.go (preserving AX_CA_BUNDLE / CA bundle vars as well while still stripping API and environment keys).

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions