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
1 check passed
renovate bot added a commit to registry-operator/registry-operator that referenced this pull request Apr 30, 2024
…security] (#39)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/hashicorp/go-getter](https://togithub.com/hashicorp/go-getter)
| `v1.7.3` -> `v1.7.4` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fhashicorp%2fgo-getter/v1.7.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fhashicorp%2fgo-getter/v1.7.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fhashicorp%2fgo-getter/v1.7.3/v1.7.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fhashicorp%2fgo-getter/v1.7.3/v1.7.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

### GitHub Vulnerability Alerts

#### [CVE-2024-3817](https://nvd.nist.gov/vuln/detail/CVE-2024-3817)

When go-getter is performing a Git operation, go-getter will try to
clone the given repository. If a Git reference is not passed along with
the Git url, go-getter will then try to check the remote repository’s
HEAD reference of its default branch by passing arguments to the Git
binary on the host it is executing on.

An attacker may format a Git URL in order to inject additional Git
arguments to the Git call.

Consumers of the go-getter library should evaluate the risk associated
with these issues in the context of their go-getter usage and upgrade
go-getter to 1.7.4 or later.

---

### Release Notes

<details>
<summary>hashicorp/go-getter (github.com/hashicorp/go-getter)</summary>

###
[`v1.7.4`](https://togithub.com/hashicorp/go-getter/releases/tag/v1.7.4)

[Compare
Source](https://togithub.com/hashicorp/go-getter/compare/v1.7.3...v1.7.4)

#### What's Changed

- Escape user-provided strings in `git` commands
[hashicorp/go-getter#483
- Fixed a bug in `.netrc` handling if the file does not exist
[hashicorp/go-getter#433

**Full Changelog**:
hashicorp/go-getter@v1.7.3...v1.7.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no
schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/registry-operator/registry-operator).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMyMS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhcmVhL2RlcGVuZGVuY3kiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

None yet

3 participants