KeyValueTable silently collapses duplicate keys on save (env vars / headers) #38

Closed
opened 2026-07-12 12:45:06 -04:00 by the_og · 0 comments
Owner

Found in audit of main @ 06326e5.

KeyValueTable.dump() (bcc.py ~L336) builds a dict from rows: a second row with the same key silently overwrites the first. A user who adds API_KEY twice (or edits a key into a collision) loses a value on save with no warning — the row is visibly present in the table but absent from the file.

Proposed fix: surface duplicates. Either (a) block them at entry — when the Add dialog / inline edit produces a key that already exists, highlight and refuse; or (b) validation-level: have ServerEditor._check_args-style warning (and/or validate_servers) report "duplicate env var 'X' — only the last value will be saved". (a) is cleaner since the table is the only writer.

Acceptance: creating a duplicate key via the Add dialog or an inline edit produces visible feedback and cannot silently drop a value; dump() output remains a dict (no format change on disk).

**Found in audit of `main` @ 06326e5.** `KeyValueTable.dump()` (`bcc.py` ~L336) builds a dict from rows: a second row with the same key silently overwrites the first. A user who adds `API_KEY` twice (or edits a key into a collision) loses a value on save with no warning — the row is visibly present in the table but absent from the file. **Proposed fix**: surface duplicates. Either (a) block them at entry — when the Add dialog / inline edit produces a key that already exists, highlight and refuse; or (b) validation-level: have `ServerEditor._check_args`-style warning (and/or `validate_servers`) report \"duplicate env var 'X' — only the last value will be saved\". (a) is cleaner since the table is the only writer. **Acceptance**: creating a duplicate key via the Add dialog or an inline edit produces visible feedback and cannot silently drop a value; `dump()` output remains a dict (no format change on disk).
the_og added the P2 label 2026-07-12 12:45:06 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: the_og/better-claude-config#38