node-red: Git SSH-Key based authentication failes, if username contains "AT" character

Current Behavior

Hello, Short: Access to a GIT system using ssh-key based authentication seems to fail because the username contains the “@” character.

I use Header based authentication on node-red and my usernames have the format of an email adress (e.g. firstname-secondname.lastname@example.com). If we try to authenticate using ssh-key based authentication it failes.

Expected Behavior

Expected behaviour is, that ssh-key authentication works.

Steps To Reproduce

Set username (e.g. using reverse-proxy header variable to an email adress and try to fetch branches of a GIT system (e.g. gitea). Configure in the project an ssh based git access ssh://git@… or git@… Set User Email and Name, generate a key. Try to push to the git repo (or first fetch branches). It will fail.

There are only these log messages:

4 Nov 16:13:26 - [trace] runGitCommandWithAuth {}
4 Nov 16:13:26 - [trace] git["fetch","origin"]

What I tried: a) Manually try an ssh:


 ssh -i /home/nodered/.node-red/projects/.sshkeys/Firstname-secondname.lastname\@example.com_gitea_key git@gitea.example.com
LDAP Login enabled
PTY allocation request failed on channel 0
Hi there, Firstname-secondname.lastname_example.com! You've successfully authenticated with the key named TheHiveWorkflow, but Gitea does not provide shell access.
If this is unexpected, please log in with password and setup Gitea under another user.
Connection to gitea@example.com closed.

b) Copied private-key /home/nodered/.node-red/projects/.sshkeys/Firstname-secondname.lastname@example.com_gitea_key to /home/nodered/.ssh/id_rsa ==> Everything works

c) I tried to output auth.key_path arround line 577 in: /usr/lib/node-red/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/index.js but it was not set (even it was configured):

Example flow

n.a.

Environment

  • Node-RED version: 2.1.3
  • Node.js version: v14.17.6
  • npm version: 6.14.15
  • Platform/OS: RHEL7
  • Browser: Chrome
  • git version: git version 2.31.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 42 (20 by maintainers)

Most upvoted comments

Also worth noting that your urls have both . and com in the repo name - firstname.lastname_example.com - which could be tripping up some url parsing somewhere in the stack.

But that is all in the git/ssh layer - node-red doesn’t do any parsing of the repo url at that level.