-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Description
Hello!
A few months back I created #923.
Back then it worked flawlessly but when I tried again today I stumbled across a session crash. I'm using the same snippet as back then:
con <- dbConnect(
odbc::odbc(),
driver = "SnowflakeDSIIDriver",
server = "XXX",
uid = "YYY",
authenticator = "snowflake_jwt",
attributes = list("sf_private_key" = pk),
)
The R session crashes with a coredump: corrupted size vs. prev_size.
I found out that if I remove the last \n of the private key it works normally. I'm just using sub("\n$", "", pk).
The difference is exactly 1 character:
nchar(pk_raw)
[1] 1704
nchar(pk_fixed)
[1] 1703
pk_raw: ends with -----END PRIVATE KEY-----\n ←
pk_fixed: ends with -----END PRIVATE KEY----- ←
However, from what I know the last \n in an openssh private key file is perfectly normal. I checked straigth from keys created using ssh-keygen:
0000640 D O P E N S S H P R I V A T
0000660 E K E Y - - - - - \n
0000673
And the openssh library also reports the key to be vaild before removing the last \n.
library(openssl)
Linking to: OpenSSL 3.0.13 30 Jan 2024
tryCatch({
+ read_key(pk)
+ message("Key format is valid!")
+ }, error = function(e) {
+ message("Key format invalid: ", e$message)
+ })
Key format is valid!
Metadata
Metadata
Assignees
Labels
No labels