KeyValueTable silently collapses duplicate keys on save (env vars / headers) #38
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 addsAPI_KEYtwice (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/orvalidate_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).