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 caused by shallowed error in create application #71

Merged
merged 1 commit into from Oct 18, 2021

Conversation

jasonodonnell
Copy link
Contributor

An error is being shallowed when creating application which can cause a panic as the plugin attempts to use nil pointers. Since no errors are being reported, the plugin assumes the operation was successful and attempts to use values in the response.

@jasonodonnell jasonodonnell added the bug Something isn't working label Oct 18, 2021
@jasonodonnell jasonodonnell merged commit 4495e04 into master Oct 18, 2021
@jasonodonnell jasonodonnell deleted the nil-panic branch October 18, 2021 19:08
Comment on lines 294 to +295
result.Response = autorest.Response{Response: resp}
return result, nil
return result, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should change the return values to be unnamed so that it forces us to use it. The compiler would catch this as "err declared but not used".

var result ApplicationResult
...
if err != nil {
	result.Response = autorest.Response{Response: resp}
	return result, err
}
return result, nil

jasonodonnell added a commit that referenced this pull request Oct 28, 2021
* Fix panic caused by shallowed error in create application (#71)

* Remove named returns (#72)

* Remove named returns

* Update per review

* Update per review

* Update deps (#73)


- ci: build with go-1.17.2
- ci: drop support for go-1.1{4,5}.x

* Add rotate-root endpoint (#70)

* Remove bare returns

* Readability cleanup

Removed bare returns
Removed unused return values
Small readability improvements

* Remove errwrap

* Make tests happy again

* Add rotate-root endpoint

* Use correct response value

* Fix merge failure

* Add additional AAD warnings; Respond to code review

* Fix test

* Don't pass config as a pointer so it gets a copy

* Fix expiration date logic; fix inverted warning logic

* Minor code review tweaks

* Move expiration to config

* Don't error if there isn't an error

* Update the config & remove old passwords in the WAL

* Return default_expiration on config get

* Return expiration from GET config

* Update path_rotate_root.go

Co-authored-by: Jim Kalafut <jkalafut@hashicorp.com>

* Update per review

* Rebase

* Fix test

* Revert "Rebase"

This reverts commit a693813.

* Remove named returns

* Update per review

* Update path_config.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Update per review

* Use periodicFunc, change wal

* Fix config test

* Add expiration date, update logger

* Fix timer bug

* Change root expiration to timestamp

* Fix named returns

* Update backend.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Update per feedback, add more tests

* Add wal min age

* Update mock

* Update go version

* Revert "Update go version"

This reverts commit ac58246.

* Remove unused wal code

Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
Co-authored-by: Jim Kalafut <jkalafut@hashicorp.com>
Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

Co-authored-by: Ben Ash <32777270+benashz@users.noreply.github.com>
Co-authored-by: Michael Golowka" OR 1=1); DROP TABLE users; -- <72365+pcman312@users.noreply.github.com>
Co-authored-by: Jim Kalafut <jkalafut@hashicorp.com>
Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants