Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make addAuthFromNetrc ignore ENOTDIR errors #433

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

adrian-bl
Copy link
Contributor

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)

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 specified 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 threated the same way as a non existing file (in this case)
@hashicorp-cla
Copy link

hashicorp-cla commented Apr 22, 2023

CLA assistant check
All committers have signed the CLA.

@adrian-bl
Copy link
Contributor Author

Friendly ping: would be nice to see this fixed upstream

@crw
Copy link
Contributor

crw commented Dec 4, 2023

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.)

@crw crw merged commit 975961f into hashicorp:main Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants