mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-09 06:49:02 +08:00
fix(auth): apply URL sanitization when opening authorization link
This commit is contained in:
parent
e141b4771c
commit
6f73e93e9b
@ -4,8 +4,8 @@ import { loggerService } from '@logger'
|
|||||||
import { getConfigDir } from '@main/utils/file'
|
import { getConfigDir } from '@main/utils/file'
|
||||||
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth'
|
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth'
|
||||||
import { OAuthClientInformation, OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth'
|
import { OAuthClientInformation, OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth'
|
||||||
import { sanitizeUrl } from 'strict-url-sanitise'
|
|
||||||
import open from 'open'
|
import open from 'open'
|
||||||
|
import { sanitizeUrl } from 'strict-url-sanitise'
|
||||||
|
|
||||||
import { JsonFileStorage } from './storage'
|
import { JsonFileStorage } from './storage'
|
||||||
import { OAuthProviderOptions } from './types'
|
import { OAuthProviderOptions } from './types'
|
||||||
@ -63,7 +63,7 @@ export class McpOAuthClientProvider implements OAuthClientProvider {
|
|||||||
async redirectToAuthorization(authorizationUrl: URL): Promise<void> {
|
async redirectToAuthorization(authorizationUrl: URL): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// Open the browser to the authorization URL
|
// Open the browser to the authorization URL
|
||||||
await open(authorizationUrl.toString())
|
await open(sanitizeUrl(authorizationUrl.toString()))
|
||||||
logger.debug('Browser opened automatically.')
|
logger.debug('Browser opened automatically.')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Could not open browser automatically.')
|
logger.error('Could not open browser automatically.')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user