ssh-keys page not showing key information

Bug #1859194 reported by Guillermo Gonzalez
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical SSO provider
Fix Released
Critical
Unassigned

Bug Description

/ssh-keys page is missing the ssh key id, type and text (maybe empty/hidden?)

Tags: vanilla

Related branches

Revision history for this message
Guillermo Gonzalez (verterok) wrote :
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

I think the issue is: the new template expects `delete_key_form.fields.ssh_keys.choices` to contain a dict with the parsed tokens for each key, but instead it's getting preformatted html code.
Expected:

  [("ssh-rsa abcdef0123456789 my key", {"label": "my key", "type": "ssh-rsa", "text": "abcdef0123456789"}), ...]

Actual:

  [("ssh-rsa abcdef0123456789 my key", "<div><ul><li><td>...<dt>my key</dt>...</div>"), ...]

The preformatted html is returned by `webui.forms.format_ssh_key()`, called by `DeleteSSHKeyForm`.

Quick fix: update this function to return {'label': comment, 'type': key_type, 'text': key_text}. According to the docstring it does the html rendering by itself for security reasons, but I don't see why it couldn't be safely rendered in the template.

Changed in canonical-identity-provider:
status: New → Triaged
Daniel Manrique (roadmr)
Changed in canonical-identity-provider:
importance: Undecided → Critical
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

This issue is not reproducible locally with the default devel setup as it depends on Launchpad for SSH key integration, and a couple of feature flags. But can still be done with a few hacks, i.e. hardcoding LP API responses and enabling those flags:

1. Make sure webserver and DB are down (stop server, then run `make stop-db`).
2. Apply diff from https://code.launchpad.net/~maxiberta/canonical-identity-provider/vanilla-sshkeys-debug/+merge/377722.
3. Setup new DB (resets all data in the local DB): `make start-db`.
4. Run service: `make run`.
5. Run debug mail server (in a different terminal): `make mail-debug`.
6. Go to the web UI and register new account, then check /ssh-keys.

A quick/hackish/incomplete/unsafe fix is included in src.webui.forms.format_ssh_key(); just uncomment it and restart the web server to try it.

Daniel Manrique (roadmr)
Changed in canonical-identity-provider:
status: Triaged → Fix Committed
Changed in canonical-identity-provider:
status: Fix Committed → Fix Released
Revision history for this message
Conor Stanley (conorjstanley) wrote :

I don't know what this is yet. I don't care.

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.