Transfer: give create_user keys a real ssh public key id - #10142
Open
Zuhef wants to merge 1 commit into
Open
Conversation
The id was a plain string with a missing f prefix, so every user's key id was the literal text mock_ssh_public_key_id_{ssh_public_key_body}_{now}. Use the same format import_ssh_public_key already produces for the same field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
create_userstores the ssh public key id as a plain string with a missingfprefix, so every user gets the same literal placeholder text as their key id:import_ssh_public_keyin the same file fills the same field properly:So the two ways of attaching a key to a user produce different shapes for the same field, and one of them is not an identifier at all.
I matched
import_ssh_public_keyrather than just adding the missingf, for two reasons: it keeps a single format for the field thatdelete_ssh_public_keyanddescribe_userboth work with, and interpolating the original string would embed the entire public key body, spaces and all, into the id. If you would rather keep the literal wording and just add thef, say so and I will switch it.One thing worth stating because it changes what this fixes:
delete_ssh_public_keystill worked before this change, since it compared the stored literal against the same literal returned bydescribe_user. The defect is the value itself being unusable and identical for every user, not a broken lookup.Added an assertion to
test_create_describe_and_delete_user, which fails without the change attests/test_transfer/test_transfer.py:200.tests/test_transferpasses (18),ruff formatis clean and mypy reports nothing.