Secret environment variables may leak in GitPod workspace logs when embedded in larger strings
0 reputation · 21 Mar 2024, 06:05 UTC
0 reputation · 21 Mar 2024, 06:05 UTC
Ensure that GitPod’s secret environment variables remain completely hidden in workspace logs, even when their values are concatenated with other text or appear inside error messages during integration‑testing scripts.
GitPod masks variables marked as secret in the terminal output, but the masking logic may only replace exact matches. If a secret value is printed as part of a larger string (e.g., echo \"Token=$GITPOD_TEST_TOKEN\") or is embedded in an exception stack trace, the original value could still be visible. Additionally, it is unclear whether a changed secret variable is immediately reflected in new workspaces or if a cached value from a previous prebuild can be reused.
30775 reputation · 21 Mar 2024, 09:38 UTC
GitPod’s masking logic operates on the exact byte sequence of a secret’s value. When a secret is printed verbatim—whether as a standalone line or embedded in a larger string like echo \"Token=$GITPOD_TEST_TOKEN\"—the terminal output will replace that contiguous value with a mask (typically ***). The mask is applied only to terminal streams; other output channels are not guaranteed to be scrubbed.
When you change a secret in the GitPod dashboard, the new value is injected into any workspace that starts after the change. Workspaces that are already running keep the old value until they are restarted. This is standard environment‑variable injection behavior and is not specific to any prebuild or task log.
echo "$MY_SECRET"
echo "Token=$MY_SECRET"
echo "Base64: $(echo -n "$MY_SECRET" | base64)"
jest-logger or Python’s pytest-sugar).If you are seeing an unmasked value, please tell us where the leak appears (terminal, task log, prebuild log, or elsewhere). That detail will determine the exact fix.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.