File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2540,6 +2540,20 @@ class OAuthHelpersImpl implements OAuthHelpers {
25402540 * @returns A Promise resolving to an object containing the redirect URL
25412541 */
25422542 async completeAuthorization ( options : CompleteAuthorizationOptions ) : Promise < { redirectTo : string } > {
2543+ const { clientId, redirectUri } = options . request ;
2544+
2545+ if ( ! clientId || ! redirectUri ) {
2546+ throw new Error ( 'Client ID and Redirect URI are required in the authorization request.' ) ;
2547+ }
2548+
2549+ // Re-validate the redirectUri to prevent open redirect vulnerabilities
2550+ const clientInfo = await this . lookupClient ( clientId ) ;
2551+ if ( ! clientInfo || ! clientInfo . redirectUris . includes ( redirectUri ) ) {
2552+ throw new Error (
2553+ 'Invalid redirect URI. The redirect URI provided does not match any registered URI for this client.'
2554+ ) ;
2555+ }
2556+
25432557 // Generate a unique grant ID
25442558 const grantId = generateRandomString ( 16 ) ;
25452559
You can’t perform that action at this time.
0 commit comments