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 in getWebConfig #11389

Merged
merged 5 commits into from
Mar 23, 2022
Merged

Fix panic in getWebConfig #11389

merged 5 commits into from
Mar 23, 2022

Conversation

rosstimothy
Copy link
Contributor

Refactored the usage of the types.AuthPreference returned from
GetAuthPreference so that it is only accessed if there were no
errors.

runtime error: invalid memory address or nil pointer dereference
goroutine 795303 [running]:
net/http.(*conn).serve.func1()
/opt/go/src/net/http/server.go:1801 +0xb9
panic({0x3cd77a0, 0x756dee0})
/opt/go/src/runtime/panic.go:1047 +0x266
github.com/gravitational/teleport/lib/web.(*Handler).getWebConfig(0xc000840500, {0x52618a0, 0xc0001f09a0}, 0xc000755400, {0xc001022240, 0x4262ed2, 0xc000b5bc80})
/go/src/github.com/gravitational/teleport/lib/web/apiserver.go:894 +0x643
github.com/gravitational/teleport/lib/httplib.MakeHandlerWithErrorWriter.func1({0x52618a0, 0xc0001f09a0}, 0xc001190920, {0x0, 0x0, 0x0})
/go/src/github.com/gravitational/teleport/lib/httplib/httplib.go:67 +0x89
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc000840518, {0x52618a0, 0xc0001f09a0}, 0xc000755400)
/go/src/github.com/gravitational/teleport/vendor/github.com/julienschmidt/httprouter/router.go:387 +0x84b
github.com/gravitational/teleport/lib/web.(*WebAPIHandler).ServeHTTP(0xc000bdb860, {0x52618a0, 0xc0001f09a0}, 0xc000755400)
/go/src/github.com/gravitational/teleport/lib/web/apiserver.go:215 +0x136
github.com/gravitational/oxy/ratelimit.(*TokenLimiter).ServeHTTP(0xc00027b100, {0x52618a0, 0xc0001f09a0}, 0xc000755400)
go/src/github.com/gravitational/teleport/vendor/github.com/gravitational/oxy/ratelimit/tokenlimiter.go:118 +0x1ce
github.com/gravitational/oxy/connlimit.(*ConnLimiter).ServeHTTP(0xc000625320, {0x52618a0, 0xc0001f09a0}, 0x10000c001022170)
/go/src/github.com/gravitational/teleport/vendor/github.com/gravitational/oxy/connlimit/connlimit.go:75+0x326
net/http.serverHandler.ServeHTTP({0xc000a17770}, {0x52618a0, 0xc0001f09a0}, 0xc000755400)
/opt/go/src/net/http/server.go:2878 +0x43b
net/http.(*conn).serve(0xc001196960, {0x52a50e0, 0xc0001199b0})
/opt/go/src/net/http/server.go:1929 +0xb08
created by net/http.(*Server).Serve
/opt/go/src/net/http/server.go:3033 +0x4e8" 
utils/cli.go:351

Refactored the usage of the types.AuthPreference returned from
GetAuthPreference so that it is only accesed if there were no
errors.
Copy link
Contributor

@codingllama codingllama left a comment

Choose a reason for hiding this comment

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

Thanks!

@rosstimothy rosstimothy merged commit 487ba57 into master Mar 23, 2022
@rosstimothy rosstimothy deleted the tross/fix_nil_cap_panic branch March 23, 2022 21:54
rosstimothy added a commit that referenced this pull request Mar 24, 2022
Refactored the usage of the types.AuthPreference returned from
GetAuthPreference so that it is only accessed if there were no
errors.
rosstimothy added a commit that referenced this pull request Mar 24, 2022
Refactored the usage of the types.AuthPreference returned from
GetAuthPreference so that it is only accessed if there were no
errors.
rosstimothy added a commit that referenced this pull request Mar 24, 2022
Refactored the usage of the types.AuthPreference returned from
GetAuthPreference so that it is only accessed if there were no
errors.
rosstimothy added a commit that referenced this pull request Mar 25, 2022
Refactored the usage of the types.AuthPreference returned from
GetAuthPreference so that it is only accessed if there were no
errors.
@webvictim webvictim mentioned this pull request Apr 19, 2022
@webvictim webvictim mentioned this pull request Jun 8, 2022
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.

4 participants