-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 an invalid oauth2 name is passed #20820
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lunny
reviewed
Aug 17, 2022
GiteaBot
added
the
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
label
Aug 17, 2022
Codecov Report
@@ Coverage Diff @@
## main #20820 +/- ##
==========================================
- Coverage 47.06% 47.05% -0.02%
==========================================
Files 987 988 +1
Lines 136398 136368 -30
==========================================
- Hits 64201 64171 -30
- Misses 64316 64317 +1
+ Partials 7881 7880 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
lunny
approved these changes
Aug 17, 2022
GiteaBot
added
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
and removed
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
labels
Aug 17, 2022
silverwind
approved these changes
Aug 17, 2022
GiteaBot
added
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
and removed
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
labels
Aug 17, 2022
Please send backport |
lunny
added
the
skip-changelog
This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
label
Aug 18, 2022
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Aug 18, 2022
* giteaofficial/main: Fix migration file name (go-gitea#20843) Check Mirror exists before linking its Repo (go-gitea#20840) [skip ci] Updated translations via Crowdin Add badge capabilities to users (go-gitea#20607) docs[zh-cn]: Managing Deployments With Environment Variables (go-gitea#20817) Correctly escape within tribute.js (go-gitea#20831) Fix panic when an invalid oauth2 name is passed (go-gitea#20820) Use the total issue count for UI (go-gitea#20785)
zeripath
pushed a commit
to zeripath/gitea
that referenced
this pull request
Aug 21, 2022
Backport go-gitea#20820 When trying to access an invalid oauth2 link, we get an internal server error and can see a panic stack-trace in logs Example: Try to go to this url for a gitea installation https://<gitea_url>/user/oauth2/DoesNotExist?redirect_to= It causes an internal server error Stack trace in log ``` 2022/08/17 01:26:50 routers/web/base.go:134:1() [E] [62fc43da] PANIC: runtime error: invalid memory address or nil pointer dereference /usr/local/go/src/runtime/panic.go:220 (0x453095) /usr/local/go/src/runtime/signal_unix.go:818 (0x453065) /source/routers/web/auth/oauth.go:1100 (0x20f6ef7) /source/routers/web/auth/oauth.go:785 (0x20f4684) /source/modules/web/wrap_convert.go:47 (0x1f45196) /source/modules/web/wrap.go:41 (0x1f433c9) /usr/local/go/src/net/http/server.go:2084 (0x93cace) <clipped> ``` Root cause: In this [line](https://github.com/go-gitea/gitea/blob/a4e91c4197483c94f13e623c962b6b011494e949/models/auth/oauth2.go#L516) here, err is nil. The caller assumes no error and tries to access a `nil *Source`
techknowlogick
pushed a commit
that referenced
this pull request
Aug 22, 2022
vsysoev
pushed a commit
to IntegraSDL/gitea
that referenced
this pull request
Aug 28, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
backport/done
All backports for this PR have been created
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
skip-changelog
This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
type/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When trying to access an invalid oauth2 link, we get an internal server error and can see a panic stack-trace in logs
Example:
Try to go to this url for a gitea installation
https://<gitea_url>/user/oauth2/DoesNotExist?redirect_to=
It causes an internal server error
Stack trace in log
Root cause:
In this line here, err is nil. The caller assumes no error and tries to access a
nil *Source