2 Commits
Author SHA1 Message Date
Juan Denis 468a68ed96 fix(security): parse restricted authorized keys 2026-08-27 20:30:17 -04:00
Juan DenisandClaude Fable 5 3de88b5f82 fix(security): join SSH key ids to the lines delete actually pops
get_ssh_keys numbered keys over raw authorized_keys lines (comments and
blanks included) while remove_ssh_key popped that id from a list of key
lines only, so any comment banner shifted every id and delete-by-id
removed the wrong key — or refused the last one as "Invalid key ID".
The rewrite also hoisted all comments to the top, shifting ids again.

- both sides now index the same sequence: non-blank, non-comment lines
  in file order; delete drops the line in place so comments keep their
  position
- add_ssh_key dedupes on the key-data token instead of a raw substring,
  and normalizes a missing trailing newline before appending so a new
  key can't be glued onto the previous line

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-27 04:02:35 -04:00