fix: add missing return after error in OAuth callback redirect#127
Merged
asdek merged 1 commit intovxcontrol:feature/project_improvementsfrom Feb 23, 2026
Conversation
In authLoginCallback(), when url.Parse fails on the return_uri, response.Success writes a 200 OK but execution continues to http.Redirect, causing a superfluous response.WriteHeader call (double response write). Add the missing return statement. Ref: vxcontrol#101 Signed-off-by: mason5052 <ehehwnwjs5052@gmail.com>
There was a problem hiding this comment.
Pull request overview
This pull request fixes a critical bug in the OAuth callback handler where a missing return statement after an error response could cause a double response write. The PR addresses issue #101, specifically point 8 about request-triggerable issues in the OAuth state parser and related error handling.
Changes:
- Added missing
returnstatement afterresponse.Success()in the error branch ofauthLoginCallback()whenurl.Parse(returnURI)fails
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f07b876
into
vxcontrol:feature/project_improvements
3 of 4 checks passed
Contributor
|
LGTM thank you for contribution! |
33 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the Change
Problem
In
authLoginCallback(), whenurl.Parse(returnURI)fails,response.Success(c, http.StatusOK, nil)writes a 200 OK response but execution falls through to line 592-595 which callshttp.Redirect(), attempting to write a second response (303 See Other). This causes a "superfluous response.WriteHeader call" warning and undefined behavior from the double response write.Solution
Add the missing
returnstatement afterresponse.Success()in the error branch to prevent execution from falling through to the redirect logic.Ref: #101
Type of Change
Areas Affected
Testing and Verification
Test Steps
cd backend && go build ./...return_uriin state dataSecurity Considerations
Without the
return, a malformedreturn_uricould cause unpredictable HTTP response behavior. The fix ensures clean error handling in the OAuth callback flow.Checklist
Code Quality
go fmtandgo vet(for Go code)Security
Compatibility