[PR #4499] [CLOSED] [Benchmark] "none" is no key for --credential-env; the key is redacted as written and as a whole word #5068

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4499
Author: @coryjett
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: fix-bench-none-key


📝 Commits (1)

  • 9c56d12 bench: "none" is no key for --credential-env; the key is redacted as written and as a whole word (#4483)

📊 Changes

5 files changed (+67 additions, -7 deletions)

View changed files

📝 strata_cli/bench_facts.py (+12 -3)
📝 strata_cli/cli.py (+1 -1)
➕ tests/terminal/test_bench_redactor.py (+41 -0)
📝 tools/strata_bench.py (+5 -3)
📝 tools/test_strata_bench.py (+8 -0)

📄 Description

Problem and result

Fixes #4483. With a run config whose api_key is "none" and STRATA_KEY=none in the environment,
strata bench run --profile ... --credential-env STRATA_KEY sent Bearer none on every request and, because the
redactor replaced the key as a case-insensitive substring, wrote "the first mpty reasoning" for "nonempty" in its
README (the run in #4468). Any key of four or more characters that is also a common word, or a short hex string that
occurs inside a hash, corrupted the README, outputs.jsonl, config.json and engine.log the same way.

After: bench_facts.credential_value() treats an empty or "none" (any case) credential as no key, the same rule the
run-config path already applied; bench run uses it for --credential-env. The key is redacted exactly as written
(case-sensitive) and only as a whole word, in strata_cli/bench_facts.py and in tools/strata_bench.py. User and
host names, home folders and private addresses are redacted as before.

#4483

Approach

A small helper plus an exact flag on the redactor's add() in both runners. The Bearer <token> pattern is
unchanged, so an authorization header is still hidden whatever the key. Touches strata_cli/cli.py at the
bench run key read (~line 1255), well away from #4476's _redact_argv change; the two apply independently.

Validation

Passed:

  • python3.12 -m unittest tests.terminal.test_bench_redactor tools.test_strata_bench tests.terminal.test_bench_standard tests.terminal.test_bench_facts_amd:
    Ran 106 tests in 54.144s, OK (1 skipped). Strata Control 0.1.52's bundled Python 3.12.15, Ubuntu 26.10, this branch (main 46c152a1 + this commit).
  • The new tests against main's bench_facts.py, cli.py and tools/strata_bench.py (production files stashed, tests kept): Ran 11 tests in 0.012s FAILED (failures=3, errors=2) (credential_value is missing on main; the substring and case cases fail).

Failed:

  • None observed.

Not run:

  • A new strata bench run with this branch.

Limits

  • A key shorter than four characters is still never redacted (unchanged floor; the Bearer pattern needs eight).
    Warning on short keys would be a separate change.
  • A key directly followed by - or a word character (abcd1234-x) is not a whole word and is not replaced; the
    old substring match would have caught it, at the cost above.

🤖 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/4499 **Author:** [@coryjett](https://github.com/coryjett) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-bench-none-key` --- ### 📝 Commits (1) - [`9c56d12`](https://github.com/Niko1221/Strata/commit/9c56d129d44906072102372d501e0daf8878b03c) bench: "none" is no key for --credential-env; the key is redacted as written and as a whole word (#4483) ### 📊 Changes **5 files changed** (+67 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `strata_cli/bench_facts.py` (+12 -3) 📝 `strata_cli/cli.py` (+1 -1) ➕ `tests/terminal/test_bench_redactor.py` (+41 -0) 📝 `tools/strata_bench.py` (+5 -3) 📝 `tools/test_strata_bench.py` (+8 -0) </details> ### 📄 Description ## Problem and result Fixes #4483. With a run config whose `api_key` is `"none"` and `STRATA_KEY=none` in the environment, `strata bench run --profile ... --credential-env STRATA_KEY` sent `Bearer none` on every request and, because the redactor replaced the key as a case-insensitive substring, wrote "the first <key>mpty reasoning" for "nonempty" in its README (the run in #4468). Any key of four or more characters that is also a common word, or a short hex string that occurs inside a hash, corrupted the README, outputs.jsonl, config.json and engine.log the same way. After: `bench_facts.credential_value()` treats an empty or "none" (any case) credential as no key, the same rule the run-config path already applied; `bench run` uses it for `--credential-env`. The key is redacted exactly as written (case-sensitive) and only as a whole word, in `strata_cli/bench_facts.py` and in `tools/strata_bench.py`. User and host names, home folders and private addresses are redacted as before. ## Related discussion #4483 ## Approach A small helper plus an `exact` flag on the redactor's `add()` in both runners. The `Bearer <token>` pattern is unchanged, so an authorization header is still hidden whatever the key. Touches `strata_cli/cli.py` at the `bench run` key read (~line 1255), well away from #4476's `_redact_argv` change; the two apply independently. ## Validation **Passed:** - `python3.12 -m unittest tests.terminal.test_bench_redactor tools.test_strata_bench tests.terminal.test_bench_standard tests.terminal.test_bench_facts_amd`: Ran 106 tests in 54.144s, OK (1 skipped). Strata Control 0.1.52's bundled Python 3.12.15, Ubuntu 26.10, this branch (main 46c152a1 + this commit). - The new tests against main's `bench_facts.py`, `cli.py` and `tools/strata_bench.py` (production files stashed, tests kept): Ran 11 tests in 0.012s FAILED (failures=3, errors=2) (`credential_value` is missing on main; the substring and case cases fail). **Failed:** - None observed. **Not run:** - A new `strata bench run` with this branch. ## Limits - A key shorter than four characters is still never redacted (unchanged floor; the `Bearer` pattern needs eight). Warning on short keys would be a separate change. - A key directly followed by `-` or a word character (`abcd1234-x`) is not a whole word and is not replaced; the old substring match would have caught it, at the cost above. 🤖 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>
bsakaguchi 2026-11-07 16:32:27 +07:00
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#5068
No description provided.