Properly support base64 encoding of SSH keys in gitPrivateKey
#41121
ldobbelsteen
started this conversation in
Suggest an Idea
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tell us more.
Currently, encoding your GPG key in base64 is supported both in both the
privateKeyandgitPrivateKeysettings. Consider this snippet from the linked documentation ofprivateKey:This is a very nice feature! However, I was having trouble earlier loading an SSH key that is encoded in base64 in its entirety (and not just the contents between the header and footer, which in the OpenSSH format is always encoded in base64) into
gitPrivateKey. After looking at the code responsible forgitPrivateKey(not sure aboutprivateKey), I could conclude that base64 encoded SSH keys are not supported bygitPrivateKeyat this moment. This is because the type of the key (either SSH or GPG) is determined using thesshKeyRegexregular expression BEFORE decoding the key from base64. Thus this regex will currently never match for SSH keys, causing them to be interpreted as GPG keys. Then AFTER being determined to be a GPG key, it would be decoded from base64. This caused errors in our Renovate runs that the GPG key was incorrect (which makes sense since it's actually a decoded SSH key).A simple solution without affecting current behavior in my eyes would be to move the decoding logic to BEFORE the regex is run on the key. Not sure what the desired behavior or support is, but the documentation and code currently are a bit ambiguous.
Beta Was this translation helpful? Give feedback.
All reactions