Skip to content

bug: newline append to ssh key #15672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gjrtimmer opened this issue Nov 27, 2024 · 2 comments · Fixed by #16602
Closed

bug: newline append to ssh key #15672

gjrtimmer opened this issue Nov 27, 2024 · 2 comments · Fixed by #16602
Assignees
Labels
api Area: HTTP API bug risk Prone to bugs need-help Assign this label prompts an engineer to check the issue. Only humans may set this.

Comments

@gjrtimmer
Copy link

gjrtimmer commented Nov 27, 2024

When requesting the user's SSH Key with the API (using Terraform script, curl), the response has a newline is appended to the SSH key, which is a bug to me because I have to remove it by hand for the key to work.

API Endpoint: /api/v2/users/me/gitsshkey

{
    "user_id": "REDACTED",
    "created_at": "2024-07-12T18:09:58.597203+02:00",
    "updated_at": "2024-11-27T14:15:10.286881+01:00",
    "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOBxIYrqi0vuWEnDlL0UzK4rHP/a/oJwF5mV5vkvZ9Gt\n"
}

This is a bug, without stripping the newline I cannot add the key to GitLab

@coder-labeler coder-labeler bot added the bug risk Prone to bugs label Nov 27, 2024
@matifali matifali added api Area: HTTP API need-help Assign this label prompts an engineer to check the issue. Only humans may set this. labels Nov 28, 2024
@deansheather
Copy link
Member

Is this new behavior? If not then this is not a bug.

Is it difficult for you to remove the newline using e.g. shell commands? I would consider this a breaking change to force every consumer of this API to now manually add the newline back if necessary for it's intended use case.

@gjrtimmer
Copy link
Author

Is this new behavior? If not then this is not a bug.

Is it difficult for you to remove the newline using e.g. shell commands? I would consider this a breaking change to force every consumer of this API to now manually add the newline back if necessary for it's intended use case.

I do not know if this is new behavior, but if it is intended, please make sure you put a warning note in the documentation that the API is appending a new line. I understand that it might break things, but adding a new line to a key does not seem right to me because the API's value is the SSH key itself, which should represent the key and not any modified data, which it now does due to the added new line. When using the ssh key, users should expect that it only contains the key not additional characters. Debugging was a pain because it was not documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API bug risk Prone to bugs need-help Assign this label prompts an engineer to check the issue. Only humans may set this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants