@mcp-use/client 2.4.5-canary.1 → 2.4.6-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,11 +3,10 @@
3
3
  *
4
4
  * Sanitizes URLs to prevent security issues by:
5
5
  * - Restricting to http/https protocols only
6
- * - Encoding URL components properly
7
- * - Validating hostnames
6
+ * - Validating URL structure using the WHATWG URL parser
8
7
  */
9
8
  /**
10
- * Sanitizes a URL string by encoding all components and validating the protocol.
9
+ * Sanitizes a URL string by validating the protocol and returning its normalized href.
11
10
  *
12
11
  * @param raw - The raw URL string to sanitize
13
12
  * @returns The sanitized URL as a string
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/auth/url.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA+B/C"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/auth/url.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa/C"}
@@ -128,7 +128,7 @@ var Logger = class {
128
128
  var logger = Logger.get();
129
129
 
130
130
  // src/utils/version.ts
131
- var VERSION = "2.4.5-canary.1";
131
+ var VERSION = "2.4.6-canary.0";
132
132
  function getPackageVersion() {
133
133
  return VERSION;
134
134
  }
@@ -822,27 +822,17 @@ import { validateClientMetadataUrl } from "@modelcontextprotocol/client";
822
822
 
823
823
  // src/auth/url.ts
824
824
  function sanitizeUrl(raw) {
825
- const abort = () => {
826
- throw new Error(`Invalid url to pass to open(): ${raw}`);
827
- };
828
825
  let url;
829
826
  try {
830
827
  url = new URL(raw);
831
- } catch (_) {
832
- abort();
833
- }
834
- if (url.protocol !== "https:" && url.protocol !== "http:") abort();
835
- if (url.hostname !== encodeURIComponent(url.hostname)) abort();
836
- if (url.username) url.username = encodeURIComponent(url.username);
837
- if (url.password) url.password = encodeURIComponent(url.password);
838
- url.pathname = url.pathname.slice(0, 1) + encodeURIComponent(url.pathname.slice(1)).replace(/%2f/gi, "/");
839
- url.search = url.search.slice(0, 1) + Array.from(url.searchParams.entries()).map(sanitizeParam).join("&");
840
- url.hash = url.hash.slice(0, 1) + encodeURIComponent(url.hash.slice(1));
828
+ } catch {
829
+ throw new Error(`Invalid url to pass to open(): ${raw}`);
830
+ }
831
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
832
+ throw new Error(`Invalid url to pass to open(): ${raw}`);
833
+ }
841
834
  return url.href;
842
835
  }
843
- function sanitizeParam([k, v]) {
844
- return `${encodeURIComponent(k)}${v.length > 0 ? `=${encodeURIComponent(v)}` : ""}`;
845
- }
846
836
 
847
837
  // src/auth/session-store.ts
848
838
  var OAuthSessionStore = class _OAuthSessionStore {