You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pass code_file=True when redacting execute_code and terminal output so code-like lines such as MAX_TOKENS=100 are not rewritten as secrets
keep prefix-based secret masking active for actual leaked tokens
add regression coverage for both terminal output and execute_code output
Context
This addresses the remaining code-output corruption reported in #33801. It is related to #33840, but includes behavior tests covering the user-visible regression.
Duplicate of #33840 — identical fix (pass code_file=True to redact_sensitive_text in execute_code and terminal). Both close #33801. This PR adds regression tests that #33840 lacks; consider merging the test coverage into #33840 or vice versa.
Thanks, agreed that #34666 overlaps with #33840 on the implementation: both pass code_file=True to redact_sensitive_text for execute_code and terminal output.
I rechecked the current diff and the practical options are:
Closing as part of the #33801 secret-redaction-corrupts-code cluster, fixed at the root in #54061 (merged: 674e16e).
The real defect was _DB_CONNSTR_RE's password group matching greedily across newlines, corrupting displayed tool output (read_file/terminal/execute_code) for any source containing a postgresql:// f-string template. The fix forbids whitespace in the userinfo/password groups so the match can't span a line, preserves brace-only template passwords under code_file=True, and passes code_file=True at the terminal/execute_code output sites. Thanks for the contribution to this area.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
P2Medium — degraded but workaround existstool/code-execexecute_code sandboxtool/terminalTerminal execution and process managementtype/bugSomething isn't working
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
code_file=Truewhen redactingexecute_codeandterminaloutput so code-like lines such asMAX_TOKENS=100are not rewritten as secretsContext
This addresses the remaining code-output corruption reported in #33801. It is related to #33840, but includes behavior tests covering the user-visible regression.
Tests
.\.venv\Scripts\python.exe -m ruff check tools\code_execution_tool.py tools\terminal_tool.py tests\tools\test_code_execution.py tests\tools\test_terminal_output_transform_hook.py.\.venv\Scripts\python.exe scripts\run_tests_parallel.py tests\tools\test_terminal_output_transform_hook.py tests\tools\test_code_execution.py tests\agent\test_redact.py -- --tb=short --timeout-method=thread -k redaction_preserves_code_like_env_names.\.venv\Scripts\python.exe -m ruff check .Closes #33801