Fix warden access proxy for catalog fetch commands with shell pipes.

resolve_fetch_command used shlex.split, which treated `|` as a literal
argument — breaking reuse-surface-hub-write-token (kubectl | base64 -d).
Piped commands now run via shell=True with inherited stdio for --fetch.
This commit is contained in:
2026-07-07 16:42:26 +02:00
parent 7d915a2eb5
commit be3b4a2a86
4 changed files with 137 additions and 27 deletions

View File

@@ -107,8 +107,8 @@ def test_proxy_fetch_runs_fully_offline_against_double(tmp_path):
fetch_command="bao kv get -field=<FIELD> <path_template>",
exec_capable=True,
)
argv = resolve_fetch_command(entry, field="API_KEY", path="platform/x/y/z")
resolved = resolve_fetch_command(entry, field="API_KEY", path="platform/x/y/z")
env = dict(os.environ, PATH=doubles_path_prepended(tmp_path))
# proxy_fetch inherits stdout; run it in a child so we can capture the stream.
result = subprocess.run(argv, capture_output=True, text=True, env=env, check=True)
result = subprocess.run(resolved.argv, capture_output=True, text=True, env=env, check=True)
assert result.stdout.strip().startswith(SYNTHETIC_PREFIX)