mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4476] [Benchmark] redact credentials by whole word; a value-less flag no longer hides the next option #5063
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5063
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4476
Author: @coryjett
Created: 10/28/2026
Status: 🔄 Open
Base:
main← Head:fix-redact-option-names📝 Commits (1)
57540e7Redact credentials by whole word, and let a value-less flag keep the next option (#4472)📊 Changes
5 files changed (+70 additions, -13 deletions)
View changed files
📝
strata_cli/bench_facts.py(+2 -1)📝
strata_cli/cli.py(+19 -8)➕
tests/terminal/test_redact_option_names.py(+43 -0)📝
tools/strata_bench.py(+2 -1)📝
tools/test_strata_bench.py(+4 -3)📄 Description
Problem and result
Fixes #4472.
_redact_argv(strata_cli/cli.py) andSECRET_KEY(strata_cli/bench_facts.py,tools/strata_bench.py) treated any name containingkey,token,secret,passwordorauthas a credential.Before this change, a benchmark report wrote
--conversation-cache-min-tokens 20000as<redacted>and droppedfit_max_tokensandSTRATA_SPEC_MIN_TOKENS. A matching flag with no value (--no-token-graph,--native-ple-key) also hid the option after it:--no-token-graph --kv int8became--no-token-graph <redacted> int8, so--kvdisappeared from the report.After: a name is a credential when one of its words (split on
-and_) iskey(s),apikey,token,secret,password,passphrase,credential(s),authorbearer. Counts like--max-tokensand--conversation-cache-min-tokensstay readable, and--api-key,--hf-token,--key,api_key,token_secretand
secret_key_baseare still hidden._redact_argvhides the next item only when it is not another--option. Avalue that starts with a single
-is still treated as the value and hidden.Related discussion
#4472
Approach
A whole-word regex in place of substring tests, with the same behaviour in the three places. Strata's options are all
--long, so "the next item is another option" isstartswith("--"). Some names that are not secrets still match aword, e.g.
token_idand--tail-role-token; they stay hidden, which errs the safe way.Validation
Passed:
python3.12 -m unittest tests.terminal.test_redact_option_names tools.test_strata_bench tests.terminal.test_bench_facts_amd tests.terminal.test_bench_standard tests.terminal.test_bench:130 tests OK (1 skipped). Strata Control 0.1.52's bundled Python 3.12.15, Ubuntu 26.10, on this branch (main
46c152a1+ this commit).tests.terminal.test_terminal tests.terminal.test_connections tests.terminal.test_visual_detail(the other usersof redaction): 63 tests OK.
tests/terminal/test_redact_option_names.pyon unchanged main: 3 of 6 fail (counts hidden, the next optionhidden,
STRATA_SPEC_MIN_TOKENSdropped). The other 3 check that credentials stay hidden, which main also does.Failed:
Not run:
strata bench runwith this branch.Limits
--hf=...) were not caught before and arenot caught now.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.