Add stricter SSH key parsing#889
Conversation
Due to the possibility of CRLFs breaking SSH keys, be slightly stricter in the parsing. We now split only on spaces rather than any whitespace, ensure the key is base64 encoded, and ensure no more than 3 fields are present in the key line.
OddBloke
left a comment
There was a problem hiding this comment.
I've identified one issue in the parse_ssh_key modifications; inline. That makes me wonder more broadly, though, if we're asking for trouble in making this parser less permissive: it's not only used for Azure's use case. I wonder if we should introduce a separate callable, or a strict parameter or something that will allow us to do the checking we want for Azure, without risking regressing other behaviour?
This reverts commit 6a84d7a.
a85f109 to
ed3e2f9
Compare
ed3e2f9 to
e54d7f9
Compare
|
Yeah, I think this is the right approach: as we've discussed, doing any more stringent validation risks excluding keys that work today that don't meet our expectations. I've also confirmed this fixed the integration test that was failing, so add some unit testing coverage and we're good to go, I think. |
e54d7f9 to
466e0a5
Compare
|
@OddBloke updated |
Proposed Commit Message
Additional Context
Test Steps
test_lp1910835.pyshould no longer fail.Checklist: