Skip to content
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

Feature Request: strip cr/lf endings from ssh key #243

Open
dieselburner opened this issue May 15, 2023 · 1 comment
Open

Feature Request: strip cr/lf endings from ssh key #243

dieselburner opened this issue May 15, 2023 · 1 comment

Comments

@dieselburner
Copy link

dieselburner commented May 15, 2023

I'm running this action on Gitea, and today I have discovered Gitea saves secrets with cr/lf Windows style endings, which makes git clone fail, even though I run Gitea via Docker, and none of my computers have Windows:

Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

I had to add this extra step to fix the issue:

- name: Fix SSH key
  run: sed -i 's/\r$//g' /root/.ssh/id_rsa

I do realize this issue is on Gitea side, which I will report, but would appreciate if you could implement same functionality but within this action and add one extra config option, for such scenarios. Like:

- name: Install SSH Key
  uses: shimataro/[email protected]
  with:
    key: ${{ secrets.SSH_KEY }}
    key_strip_cr: true
    known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
    config: |
      Host git.example.com
        Port 12345
        User git

Thanks!

@dieselburner
Copy link
Author

Apparently this is not Gitea related issue, but rather browser: whatwg/html#6647
I work on Chrome, and seems like Chrome converts to crlf endings, which means if one adds ssh key into repository secrets, it is impossible to use this key without such a fix which I mentioned above.

Based on these facts, I think stripping cr from ssh key by default would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant