Skip to content

Commit c3e3b27

Browse files
committed
fix(auth): sanitize authorization URL
1 parent aa6a98a commit c3e3b27

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"serve-handler": "^6.1.6",
5050
"tailwind-merge": "^2.5.3",
5151
"tailwindcss-animate": "^1.0.7",
52-
"zod": "^3.25.76"
52+
"zod": "^3.25.76",
53+
"strict-url-sanitise": "^0.0.1"
5354
},
5455
"devDependencies": {
5556
"@eslint/js": "^9.11.1",

client/src/lib/auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
OAuthMetadata,
99
} from "@modelcontextprotocol/sdk/shared/auth.js";
1010
import { SESSION_KEYS, getServerSpecificKey } from "./constants";
11+
import { sanitizeUrl } from 'strict-url-sanitise';
1112

1213
export const getClientInformationFromSessionStorage = async ({
1314
serverUrl,
@@ -129,7 +130,7 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
129130
}
130131

131132
redirectToAuthorization(authorizationUrl: URL) {
132-
window.location.href = authorizationUrl.href;
133+
window.location.href = sanitizeUrl(authorizationUrl.href);
133134
}
134135

135136
saveCodeVerifier(codeVerifier: string) {

0 commit comments

Comments
 (0)