everything-claude-code/skills/continuous-learning-v2
Affaan Mustafa 51184b692e fix(continuous-learning): eliminate _SECRET_RE catastrophic backtracking + orphaned-CPU hang (#2278)
The observe hook's secret-scrub regex used a generic ([A-Za-z]+\s+)? group
that overlapped the separator and value classes, causing exponential
backtracking on identifier-dense tool I/O — an orphaned python child then
pegged a core at ~100% CPU for days because the async hook timed out without
killing it.

- Rewrite _SECRET_RE as a linear matcher: bounded separator {1,8}, a fixed
  set of auth schemes (bearer|basic|token|bot) instead of [A-Za-z]+, and a
  bounded value {8,256}. Pathological input drops from hang to <1ms; real
  secrets still redact (verified incl. 'Bearer <token>').
- Add a signal.alarm(8) self-timeout to both scrub blocks so any runaway
  child self-terminates before the 10s async-hook timeout can orphan it.
2026-06-18 16:34:11 -04:00
..