Skip to content

Commit

Permalink
Validate the Auth URL (#3787)
Browse files Browse the repository at this point in the history
We should check and validate me thinks!

Signed-off-by: Luke Hinds <luke@stacklok.com>
  • Loading branch information
lukehinds committed Jul 4, 2024
1 parent 3f9c382 commit d521faa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/controlplane/handlers_oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ func (s *Server) GetAuthorizationURL(ctx context.Context,
return nil, status.Errorf(codes.Internal, "error getting GitHub App config: %s", err)
}
authorizationURL = fmt.Sprintf("%s/apps/%v/installations/new?state=%v", githubURL, gitHubAppConfig.AppName, state)
_, err := url.Parse(authorizationURL)
if err != nil {
return nil, status.Errorf(codes.Internal, "error parsing URL: %s", err)
}
} else if slices.Contains(providerDef.AuthorizationFlows, db.AuthorizationFlowOauth2AuthorizationCodeFlow) {
authorizationURL = oauthConfig.AuthCodeURL(state, oauth2.AccessTypeOffline)
}
Expand Down

0 comments on commit d521faa

Please sign in to comment.