SSH keys can have useless trailing newlines

Bug #230969 reported by Andrew Bennetts
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Medium
Unassigned

Bug Description

It's possible to add SSH keys with trailing newlines. For example, at the moment https://edge.launchpad.net/~hypatia/+sshkeys is:

"""ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5VCN2kJB2v1tSLHTK5D8syDE0Wl6Qf7xCQYNON9slPqpEfw61QCJl1UgqO/B7t/rwZgQ+mwQdL/r5Aq7WLVLQWDG4stvdNsZUZc/R4nTr/vyFC+N81UQ+E514YL2ElgpsRgfZAkrtFY6+bJTZn2Ixa1NUoKh1945/Somt4pAADhFqtr/3B4k8CiNsylGm+P9TTWjffnZQiYNbiQKSCd7pQOd5LMtOn9ZOkc7TenfpEVBMXDUtE8LKxf1w2z6qux6u30ZPfAZyYCxfYO1vgRvuglTBA4f5DEQTKlLuQgVjTAGkQ0AKFHln0SpEpfhVwTPRgTkNpJ1UoP9ziZIZUFSbw== mary@flay
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxik81VyNFVgIhlCnoOLVgl4pkVXvJM3TZszs0w3kI8yP7Amk3Fu8Xskn6ZHeSFf9quYQHR0yepbMfLyHs+u5mLznmf+WvGk9n3inp2YPZGZSy3UgmG1Vzh/q97gg0eKWSawP8Sh3TGrU9o7lbqZEa1N9oXOK4NE+Ci81QUf5imgiYdfs70JfzSWq3VFVHI9AIF6jq6F2H1K6k/udKVIiPNDpKk7wgPMu4rP/rPoWK2lheGA0DZv7L5jom3zpFSNimMdFXa0c/Y0RKzcYa5/mmUfhqfrHJ6zXOBfkQ7qPh+LbpAlrdE6+XEhJwLfI0RzfvpttsXTeTqOiI7LP8/ANJQ== mary@swelter

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzCdTq3vIOlj8hGLTLR5c5KoqtJTlzE/KBWc/pGmTqY8EEJHUU48ALegzbYbKB4lVpXHz2K2ZHIeGzdTmpW+H6ZfccAJ8CJq+qNfVPf5rZ+12dNOnIb9dCcZq8ix4xaqqhOUWTQ+ODpGcq7Eanbp+5iA6vT6pUN96WMuzPjYbC+FHR/Eh4pGUtQ2JoDKrRFc+dzVVbk7uuUX9Cx0wQTh250liw0l0D5e3/IbhIim1V5wLJsmdBcb44Op/7qURXYPuJ2VaR9L2YEpf3+UxMmDR/x4gaUXXuIkfTAYc3+HvaXe5C3EEOre3GGzf0p/vYq6XT5Iftu7r7i5paYQ+jsa1Qw== gardiner@marcus

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAu2muovQFVXYHiR8nos1Tn2Jwz9g05riTCD5YY1MagJ40BgP/+zjJ93eeaCCxbJKxRcaOGBFVfKo+n6dHmci857tEK6apBINslodEmaU3V1DAKHQ/sAILJyvg0d0GWQcNYaOO55CL1NO84tz5rxcjKrf8Icm5C2GK/AxsYf/J+lmNYYXoRbupP9EkUDKYMA83wTY2ImzE49zOi636n9tZkiN1dCvzWjd0+8009aeMagz/ph7L1Y12mjbhuM6r8iYIDj4WrLAOCs0mt7VY7GtIv5N/OMgOWT8B+/AKUnRO1xNEPhNwzBeiRuX/8527L0wloiYUe2I1hpioFWB84JPbsw== mary@gertrude"""

Note the blank lines between some keys, due to trailing newlines in some of the keys. This probably happens because it's easy to accidentally include a newline when copying-and-pasting a key from a terminal/editor into the form in Launchpad.

Launchpad ought to just strip the trailing whitespace. There's no reason to preserve it, and it makes it harder to write scripts that use <https://launchpad.net/~PERSON/+sshkeys>.

Changed in launchpad:
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.