security: extend credential redaction to mysql -p<password> and PG* env-var idioms

Aperta
#1,287 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
mysql, postgresql, typescript
Ambito
cli, security

Direzione di ricerca

Inizia da packages/opencode/src/session/compaction.ts e verifica come redactLedgerDetail e maskString utilizzano il catalogo esistente dei flag delle credenziali, in particolare i pattern nello stile di #1246. Trova i test di regressione esistenti per la redazione delle credenziali e aggiungi casi per mysql -psecret, mysqldump -uroot -psecret e PGPASSWORD=secret psql. Il lavoro è completato quando questi idiomi vengono mascherati senza introdurre regressioni nei casi di redazione esistenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

#1246 closed a specific credential leak in ledger text: curl -u <user> <password> (space-separated) surviving redactLedgerDetail/maskString and getting persisted into a model prompt across session compaction. The fix is correct and well-tested for that exact idiom, but scoped narrowly to USER_FLAG_RE (curl-specific -u/--user) plus generic name=value / --flag=value / colon-shaped patterns.

Two sibling credential idioms in the same risk class are not caught by the current catalog in packages/opencode/src/session/compaction.ts:

  1. MySQL client unseparated flag+value: mysql -psecret / mysqldump -uroot -psecret — no =, no space, no colon between flag and value. Neither USER_FLAG_RE nor the generic patterns match this shape.
  2. Env-var-assigned credentials with no separator character before the sensitive name: PGPASSWORD=secret psql ... is not flagged as sensitive because SENSITIVE_NAME's boundary requirement ((?:^|[_-])password(?:$|[_-])) requires a _/- immediately before "password" — PGPASSWORD has neither.

Neither is new in this release; #1246 just closed one specific case, and its commit message framed it as closing "a curl -u credential leak" rather than the broader class.

Proposed fix

Sweep the full redactLedgerDetail/maskString credential-flag catalog for common CLI credential idioms (mysql, psql/PG* env vars, and any other unseparated -X<value> or unconventional env-var-name patterns) and extend the regex catalog + add regression tests per idiom, following the same pattern as the #1246 fix.

Provenance

Found during the v0.11.0 stable release's Chaos Gremlin (privacy/compliance) persona review, verified by reading packages/opencode/src/session/compaction.ts.

Lingua principale
TypeScript
Stelle
813
Fork
134
Merge medio
2g 5h
PR unite (30g)
62

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AltimateAI/altimate-code

Tutte le issue di AltimateAI/altimate-code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.