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

Fix panic when looking up home #15160

Merged
merged 1 commit into from Jan 17, 2024
Merged

Fix panic when looking up home #15160

merged 1 commit into from Jan 17, 2024

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Jan 17, 2024

Description

Fixes #15159.

user.Current() can potentially return nil in cases where the user lookup fails, further there's a chance that HomeDir might be empty even if a user is found. This makes both of these cases an error, preventing a panic in the former and preventing trying to use "/.pulumi/" in the later.

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@Frassle Frassle requested a review from a team January 17, 2024 08:44
@pulumi-bot
Copy link
Contributor

Changelog

[uncommitted] (2024-01-17)

Bug Fixes

  • [cli] Fix a panic when user's home directory could not be looked up.
    #15160

@Frassle Frassle marked this pull request as ready for review January 17, 2024 08:50
@Frassle Frassle added this pull request to the merge queue Jan 17, 2024
Merged via the queue into master with commit e4fe131 Jan 17, 2024
46 checks passed
@Frassle Frassle deleted the fraser/homePanic branch January 17, 2024 10:23
github-merge-queue bot pushed a commit that referenced this pull request Jan 18, 2024
### Features

- [sdk/go] Add WithValue to pulumi.Context
  [#15149](#15149)


### Bug Fixes

- [cli] Fix a panic when user's home directory could not be looked up.
  [#15160](#15160)

- [cli/display] Fix JSON/YAML value diff displays.

- [sdk/go] Update github.com/cloudflare/circl to v1.3.7.
  [#15151](#15151)

- [cli/import] --import-file now omits empty resource lists.
  [#15132](#15132)

- [sdk/python] Allow remote components to use output property called id


### Miscellaneous

- [sdkgen] Emit a warning when using id or urn as resource outputs
  [#15060](#15060)
@justinvp justinvp mentioned this pull request Jan 18, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jan 18, 2024
### Features

- [sdk/go] Add WithValue to pulumi.Context
  [#15149](#15149)


### Bug Fixes

- [cli] Fix a panic when user's home directory could not be looked up.
  [#15160](#15160)

- [cli/display] Fix JSON/YAML value diff displays.
  [#15171](#15171)

- [sdk/go] Update github.com/cloudflare/circl to v1.3.7.
  [#15151](#15151)

- [cli/import] --import-file now omits empty resource lists.
  [#15132](#15132)

- [sdk/python] Allow remote components to use output property called id
  [#15115](#15115)


### Miscellaneous

- [sdkgen] Emit a warning when using id or urn as resource outputs
  [#15060](#15060)
@gmwiz gmwiz mentioned this pull request Apr 8, 2024
6 tasks
github-merge-queue bot pushed a commit that referenced this pull request Apr 9, 2024
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

#15160 tries to fix
#15159 by checking that user is
nil or user.HomeDir is nil. Given github.com/tweekmonster/luser embeds
the builtin Golang User type as pointer, it still possible that
user.User is nil and calling user.HomeDir causes a nil pointer access.
this PR checks the embedded pointer explicitly

Fixes #15159

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
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.

Pulumi CLI crashed
3 participants