[PR #4476] [Benchmark] redact credentials by whole word; a value-less flag no longer hides the next option #5063

Open
opened 2026-11-07 16:32:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 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)

  • 57540e7 Redact 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) and SECRET_KEY (strata_cli/bench_facts.py,
tools/strata_bench.py) treated any name containing key, token, secret, password or auth as a credential.
Before this change, a benchmark report wrote --conversation-cache-min-tokens 20000 as <redacted> and dropped
fit_max_tokens and STRATA_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 int8 became
--no-token-graph <redacted> int8, so --kv disappeared from the report.

After: a name is a credential when one of its words (split on - and _) is key(s), apikey, token, secret,
password, passphrase, credential(s), auth or bearer. Counts like --max-tokens and
--conversation-cache-min-tokens stay readable, and --api-key, --hf-token, --key, api_key, token_secret
and secret_key_base are still hidden. _redact_argv hides the next item only when it is not another --option. A
value that starts with a single - is still treated as the value and hidden.

#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" is startswith("--"). Some names that are not secrets still match a
word, e.g. token_id and --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 users
    of redaction): 63 tests OK.
  • The new tests/terminal/test_redact_option_names.py on unchanged main: 3 of 6 fail (counts hidden, the next option
    hidden, STRATA_SPEC_MIN_TOKENS dropped). The other 3 check that credentials stay hidden, which main also does.

Failed:

  • None observed.

Not run:

  • The full test suite and any engine build (Python only, no engine code touched).
  • A new strata bench run with this branch.

Limits

  • Credentials passed under a name with none of those words (for example --hf=...) were not caught before and are
    not caught now.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4476 **Author:** [@coryjett](https://github.com/coryjett) **Created:** 10/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-redact-option-names` --- ### 📝 Commits (1) - [`57540e7`](https://github.com/Niko1221/Strata/commit/57540e7acab472e5c74ed5939f19932cb1a41a0f) Redact credentials by whole word, and let a value-less flag keep the next option (#4472) ### 📊 Changes **5 files changed** (+70 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description ## Problem and result Fixes #4472. `_redact_argv` (`strata_cli/cli.py`) and `SECRET_KEY` (`strata_cli/bench_facts.py`, `tools/strata_bench.py`) treated any name containing `key`, `token`, `secret`, `password` or `auth` as a credential. Before this change, a benchmark report wrote `--conversation-cache-min-tokens 20000` as `<redacted>` and dropped `fit_max_tokens` and `STRATA_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 int8` became `--no-token-graph <redacted> int8`, so `--kv` disappeared from the report. After: a name is a credential when one of its words (split on `-` and `_`) is `key(s)`, `apikey`, `token`, `secret`, `password`, `passphrase`, `credential(s)`, `auth` or `bearer`. Counts like `--max-tokens` and `--conversation-cache-min-tokens` stay readable, and `--api-key`, `--hf-token`, `--key`, `api_key`, `token_secret` and `secret_key_base` are still hidden. `_redact_argv` hides the next item only when it is not another `--option`. A value 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" is `startswith("--")`. Some names that are not secrets still match a word, e.g. `token_id` and `--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 users of redaction): 63 tests OK. - The new `tests/terminal/test_redact_option_names.py` on unchanged main: 3 of 6 fail (counts hidden, the next option hidden, `STRATA_SPEC_MIN_TOKENS` dropped). The other 3 check that credentials stay hidden, which main also does. **Failed:** - None observed. **Not run:** - The full test suite and any engine build (Python only, no engine code touched). - A new `strata bench run` with this branch. ## Limits - Credentials passed under a name with none of those words (for example `--hf=...`) were not caught before and are not caught now. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5063
No description provided.