Files
ruflo/v3/@claude-flow
Dragan SpiridonovandRuflo & AQE 6b7f267abe fix(hooks): redact Google, Cognitum and header/query-string keys in recorded commands (#5062)
* fix(hooks): redact Google, Cognitum and header/query-string keys in recorded commands

redactCommandForStorage (#4056) caught Authorization headers, --token flags,
*_TOKEN= assignments and well-known token shapes, but stored these verbatim:

- Google API keys (AIza…, 39 chars) — Firebase/identitytoolkit ?key= calls and
  Gemini keys;
- Cognitum API keys (cog_…);
- keys sent in x-api-key / X-Goog-Api-Key / x-auth-token headers;
- ?key= / &api_key= query-string credentials.

Adds two rules and two shapes; each is bounded like the existing ones, and the
hostile-input test covers the new prefixes. 8 new cases: 7 fail on main, all
35 pass with the fix. Fixtures are built by concatenation so secret scanners
do not flag them (gitleaks: no leaks in the diff).

Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01GLQCdgnsuwts6j51rwcqgB

* fix(hooks): close quoted-value and form-body leaks in command redaction

Review follow-up for the recorded-command redactor:

- header and Authorization rules accept a quoted value, so object-literal
  headers ({"x-api-key":"..."}) no longer leak
- new JSON/object-literal rule for api_key/apiKey/access_token/auth_token
  and quoted bare 'key'
- form bodies: api_key=/apikey= after whitespace or a quote, and bare key=
  after -d / --data*
- more header names (apikey, api-key, Ocp-Apim-Subscription-Key,
  Private-Token, X-Auth-Key, x-access-token) with an optional scheme;
  a colon is still required, so `grep -rn x-api-key src` is untouched
- cog_ keys matched as cog_ + 64 lowercase hex with hex lookarounds:
  catches prefix_cog_<hex>, leaves cog_SomeIdentifier alone
- bare ?token= no longer redacted (pagination cursors); ?key= kept on
  purpose and pinned by a test
- flag rule needs a non-word, non-dash char before its dash, so it no
  longer fires inside x-api-key (kept the colon of "x-api-key :v")
- negative tests with exact output; hostile-input test extended

Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01GLQCdgnsuwts6j51rwcqgB
2026-11-22 14:45:49 -05:00
..
2026-11-20 22:21:35 -05:00
2026-11-19 02:12:49 -05:00
2026-11-19 02:12:49 -05:00
…