Repository navigation
Conversation
…ensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
fivanovicTT
left a comment
There was a problem hiding this comment.
A few follow-up observations on the redaction behavior. The display-only approach makes sense; these comments focus on matching and copying the printed command.
| key_upper = key.upper() | ||
| if ( | ||
| key_upper in sensitive_env_keys | ||
| or "TOKEN" in key_upper |
There was a problem hiding this comment.
Could we narrow the token matching? "TOKEN" in key_upper also redacts ordinary settings such as VLLM__MAX_NUM_BATCHED_TOKENS=3072, which our embedding model specs use, and TOKENIZERS_PARALLELISM=false. This hides useful debugging information and makes copied commands pass ***REDACTED*** where a number or boolean is expected. Known credential names plus narrower patterns such as _TOKEN, _SECRET, and _PASSWORD would avoid these false positives. A regression test for an ordinary token-count setting would be useful.
| or "PASSWORD" in key_upper | ||
| or key_upper.endswith("_KEY") | ||
| ): | ||
| return f"{key}=***REDACTED***" |
There was a problem hiding this comment.
The placeholder is appropriate for diagnostic logs, but copying the printed command now sets the container API key to the literal ***REDACTED***. That changes authentication behavior, so the PR description’s promise to preserve runnable commands needs qualification. Could we label this output as requiring credential substitution, or handle --print-docker-cmd separately? For manual execution, -e API_KEY can inherit the value without printing it, provided the variable is exported in the environment where Docker runs. Please also test that formatting leaves the original execution arguments unchanged.
| ): | ||
| next_quoted = shlex.quote(docker_command[i + 1]) | ||
| next_arg = docker_command[i + 1] | ||
| if docker_command[i] in ("-e", "--env"): |
There was a problem hiding this comment.
Smaller completeness point: this catches separate -e KEY=value and --env KEY=value arguments, but inline forms such as --env=API_KEY=... and -eAPI_KEY=... still expose the value. Current command generation uses separate arguments, so this does not block the immediate fix. Could we either document that input assumption or cover the inline forms with redaction and focused tests?
Potential fix for https://github.com/tenstorrent/tt-inference-server/security/code-scanning/35
The best fix is to preserve current functionality (still print runnable Docker commands) while masking values of sensitive
-eenvironment variables in the printed output only. Do not change how real commands are executed; only sanitize display strings.Implement this in
workflows/run_docker_server.pyby updatingformat_docker_commandto detect-e KEY=valuearguments and replace values for sensitive keys (for exampleAPI_KEY,OPENAI_API_KEY, and common secret-token key patterns) with a placeholder like***REDACTED***. Becauserun.pyalready usesformat_docker_command(...)for the flagged print path, this single change addresses all listed variants at once, including single-host and multi-host printed command paths, without altering runtime behavior.Suggested fixes powered by Copilot Autofix. Review carefully before merging.