cloudyr / aws.signature

Amazon Web Services Request Signatures
https://cloud.r-project.org/package=aws.signature
31 stars 33 forks source link

`read_credentials()` loads incorrectly trailing lines as the value (incl. embedded newlines) #52

Closed s-u closed 4 years ago

s-u commented 4 years ago

Please specify whether your issue is about:

~/.aws/credentials:
[default]
aws_access_key_id = ABC
aws_secret_access_key = DEF
# foo = bar

Expected: key=ABC, secret=DEF Actual:

> str(aws.signature::locate_credentials())
List of 4
 $ key          : chr "ABC"
 $ secret       : chr "DEF\n# foo = bar"
 $ session_token: NULL
 $ region       : chr "us-east-1"

Note the embedded newline in the secret and the trailing content causing the authentication to fail.

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] aws.s3_0.3.21

loaded via a namespace (and not attached):
[1] httr_1.4.1          compiler_3.6.3      R6_2.4.1           
[4] tools_3.6.3         base64enc_0.1-3     curl_4.3           
[7] aws.signature_0.5.2 xml2_1.3.0          digest_0.6.25      
jon-mago commented 4 years ago

Thanks for this bug report. I'll try and get a fix out soon

s-u commented 4 years ago

Thanks, much appreciated!