Skip to content

fix(agent): stop host env vars from overriding renamed secret bindings - #43

Merged
radim10 merged 3 commits into
masterfrom
fix/agent-binding-host-env-override
Sep 26, 2026
Merged

radim10 merged 3 commits into
masterfrom
fix/agent-binding-host-env-override

Conversation

@radim10

@radim10 radim10 commented Sep 26, 2026

Copy link
Copy Markdown
Member

Summary

  • When an agent profile renamed a secret with env = "...", a host variable with that same name (e.g. a stale GITHUB_PAT_TOKEN in the invoking shell) replaced the fetched secret. The proxy then injected the wrong credential and GitHub returned 401 Bad credentials.
  • Cause: expand_and_inject_env lets process env override secret values, and it runs after apply_secret_bindings has already renamed the secret to its env name.
  • Fix: agent-profile runs (non-empty secret bindings) now use expand_env_without_process_override. Values are still expanded, but a host variable can't replace them. Plain stashbase run behaves as before.

Test plan

  • Unit test: host var with the bound name doesn't override the fetched value
  • Profile parsing test: env rename alongside [secrets] project/environment
  • Proxy test: placeholder injection works for a renamed binding
  • Manual: Docker profile with env = "GITHUB_PAT_TOKEN" authenticates against api.github.com/user

@radim10 radim10 self-assigned this Sep 26, 2026
@radim10
radim10 merged commit 39fba74 into master Sep 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant