"Invalid SSH key data" for SSH key with no comment is unclear

Bug #1805650 reported by Daniel Manrique
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Launchpad itself
New
Undecided
Unassigned

Bug Description

How to reproduce:

- Try adding an SSH key with no comment:
  - ssh-keygen -f commentless-key -C ''
  - https://launchpad.net/%7E/+editsshkeys and add the generated (commentless-key.pub) key which only contains "ssh-rsa $BASE_64_PAYLOAD".

What should happen:
  - A nice error saying 'Invalid data: a comment is required' or something telling me what's actually needed.

What actually happens:
  - Unclear error: Invalid SSH key data: "the-stuff-I-tried-to-post"

This error comes from lib/lp/registry/model/person.py SSHKeySet.extract_ssh_key_components.

The same error is sent to SSO via the API so any improvement in the error message here would also benefit SSH key handling from SSO.

I guess clearly stating what the expected format of the key is (both in SSO and Launchpad) would be a cheap mitigation; I was also under the impression a public SSH key was entirely unambiguous so "Invalid data" should be enough, but then ran into this case where a comment-less SSH key is valid and usable but Launchpad dislikes it.

Revision history for this message
Daniel Manrique (roadmr) wrote :

https://bugs.launchpad.net/launchpad/+bug/60601 is relevant but not exactly a dupe; I'd be happy to just get a relevant error but still making the comment mandatory, while that one wants allowing comment-less keys.

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.