hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.65k stars 232 forks source link

Make addAuthFromNetrc ignore ENOTDIR errors #433

Closed adrian-bl closed 10 months ago

adrian-bl commented 1 year ago

The function already returns early if the specified 'netrc' configuration points to a non existing file, but currently returns an error if the OS reports ENOTDIR:

This will happen if the $HOME directory of the current user points to a file instead a directory - something eg. 'void linux' does for user 'nobody':

$ grep nobody /etc/passwd
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false

go-getter then attempts to open /dev/null/.netrc which fails with ENOTDIR - something that should just be treated the same way as a non existing file (in this case)

hashicorp-cla commented 1 year ago

CLA assistant check
All committers have signed the CLA.

adrian-bl commented 10 months ago

Friendly ping: would be nice to see this fixed upstream

crw commented 10 months ago

Hi @adrian-bl, I ran this past the Terraform, Nomad, and Product Security teams, and got sign-off to merge. Thanks for the submission! (Specifically, @apparentlymart, @tgross, and @eastebry.)