Repository navigation
fix!: redact agent environment variable values in API responses - #31932
Conversation
Workspace, build, and agent API responses returned agent environment variable values verbatim. Template authors commonly pass credentials through coder_env, and there is no way to tell which values are sensitive, so redact every non-empty value with ***REDACTED***, matching the support bundle and the agent debug manifest. Keys are preserved. The agent still receives the real values through its manifest.
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
ethanndickson
left a comment
There was a problem hiding this comment.
Should this be labelled a breaking change?
|
I guess that's true, I'll label it properly |
Workspace, build, and agent API responses (
/workspaces,/workspacebuilds/{id},/workspaceagents/{id}, and so on) returned agent environment variable values in plain text. Template authors often pass credentials such as API tokens throughcoder_env, so anyone who could read the workspace could read those secrets.db2sdk.WorkspaceAgentnow replaces every non-empty value with***REDACTED***and keeps the keys. This is the same marker the support bundle (sanitizeEnv) and the agent/debug/manifestendpoint already use. The agent still gets the real values through its manifest (db2sdk.WorkspaceAgentEnvironment), and nothing in the CLI or frontend reads these values from the API.Every value is redacted because neither
coder_envnorcoder_agent.envin the Terraform provider has a sensitive flag, andproto.Envhas no field to carry one. Selective redaction would need changes to the provider, the proto, and the database.For changelog
Agent environment variable values are redacted in API responses (fix!: redact agent environment variable values in API responses #31932)
Closes ENG-1505 (coder/security#51)
Decision log
main(e1c3a21):db2sdk.WorkspaceAgentcopieddbAgent.EnvironmentVariablesstraight intocodersdk.WorkspaceAgent.EnvironmentVariables. Every API path that returns an agent goes through this function.terraform-provider-coderv2.20.0 (coder_envhas onlyagent_id,name,value,merge_strategy;coder_agent.envis a plain map), and name heuristics fail in both directions.***REDACTED***to match the existing support bundle and/debug/manifestredaction. Empty values are kept, which also matches existing behavior.TestWorkspaceAgent/RedactsEnvironmentVariablescovers the workspace, workspace agent, and workspace build endpoints. It fails without the fix.