Details
-
Bug
-
Resolution: Fixed
-
Major
-
COmanage Registry 4.3.5 (Ruddy Rex MR5)
Description
The function addFromKeyFile in SshKey.php uses explode() to split the text uploaded for an SSH key into the triple of type, key, and comment (this is after the logic that determines whether the key is OpenSSH format or RFC 4716).
A user could (and has!) combined multiple OpenSSH keys into one file and then uploaded that text.
The result is a "valid" type, key, and then a comment that contains the original comment from the first key in the upload along with newlines and then the additional keys.
This invalid comment later ends up being displayed in the view and when trying to click the button to delete it, the invalid comment is sent to the Javascript function js_confirm_generic() which throws an exception because of the newlines in the invalid comment. As a result the Delete button appears to do nothing (the failure is immediately obvious by inspecting the console output in the browser).
The addFromKeyFile should probably do some simple tests to make sure that the type, key, and comment are reasonable and throw an InvalidArgumentException otherwise.
At a minimum the logic can make sure there are no newline characters in the comment to prevent the precise failure noted above.
Attachments
Issue Links
- is related to
-
CO-2903 SshKeyAuthenticator import multiple keys from file
-
- Open
-