-
Notifications
You must be signed in to change notification settings - Fork 195
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
🐛 New features fix #396
🐛 New features fix #396
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,13 +104,32 @@ | |
case ProviderVertical.Unknown: | ||
break; | ||
} | ||
|
||
res.redirect(returnUrl); | ||
} catch (error) { | ||
handleServiceError(error, this.logger); | ||
} | ||
} | ||
|
||
@Get('gorgias/oauth/install') | ||
handleGorgiasAuthUrl( | ||
@Res() res: Response, | ||
@Query('account') account: string, | ||
@Query('response_type') response_type: string, | ||
@Query('nonce') nonce: string, | ||
@Query('scope') scope: string, | ||
@Query('client_id') client_id: string, | ||
@Query('redirect_uri') redirect_uri: string, | ||
@Query('state') state: string, | ||
) { | ||
try { | ||
if (!account) throw new Error('account prop not found'); | ||
const params = `?client_id=${client_id}&response_type=${response_type}&redirect_uri=${redirect_uri}&state=${state}&nonce=${nonce}&scope=${scope}`; | ||
res.redirect(`https://${account}.gorgias.com/oauth/authorize${params}`); | ||
Check warning Code scanning / CodeQL Server-side URL redirect Medium
Untrusted URL redirection depends on a
user-provided value Error loading related location Loading There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure the |
||
} catch (error) { | ||
handleServiceError(error, this.logger); | ||
} | ||
} | ||
|
||
@ApiOperation({ | ||
operationId: 'getConnections', | ||
summary: 'List Connections', | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -91,9 +91,11 @@ export function needsSubdomain(provider: string, vertical: string): boolean { | |||||||||
// Extract the provider's config | ||||||||||
const providerConfig = providersConfig[vertical][provider]; | ||||||||||
|
||||||||||
const authBaseUrlStartsWithSlash = providerConfig.urls.authBaseUrl!.startsWith('/'); | ||||||||||
const apiUrlStartsWithSlash = providerConfig.urls.apiUrl!.startsWith('/'); | ||||||||||
const authBaseUrlStartsWithSlash = providerConfig.urls.authBaseUrl!.substring(0,1) === '/'; | ||||||||||
const apiUrlStartsWithSlash = providerConfig.urls.apiUrl!.substring(0,1) === '/'; | ||||||||||
Comment on lines
+94
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider reverting the check for leading slashes to use - const authBaseUrlStartsWithSlash = providerConfig.urls.authBaseUrl!.substring(0,1) === '/';
- const apiUrlStartsWithSlash = providerConfig.urls.apiUrl!.substring(0,1) === '/';
+ const authBaseUrlStartsWithSlash = providerConfig.urls.authBaseUrl!.startsWith('/');
+ const apiUrlStartsWithSlash = providerConfig.urls.apiUrl!.startsWith('/'); Committable suggestion
Suggested change
|
||||||||||
const apiUrlIsBlank = providerConfig.urls.apiUrl! === ''; | ||||||||||
|
||||||||||
//console.log("subdomain needed "+ authBaseUrlStartsWithSlash) | ||||||||||
|
||||||||||
return authBaseUrlStartsWithSlash || apiUrlStartsWithSlash || apiUrlIsBlank; | ||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review the necessity of logging and potential information leakage.
The use of
console.log
to output whether a subdomain is needed could lead to information leakage in a production environment. Consider removing this log or replacing it with a more secure logging mechanism that filters sensitive information.