@vitemcp/server 1.6.1 → 1.6.3
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.
- package/dist/{OAuthProvider-CoIruClQ.d.cts → OAuthProvider-CWBi3c3D.d.cts} +23 -1
- package/dist/{OAuthProvider-CoIruClQ.d.ts → OAuthProvider-CWBi3c3D.d.ts} +23 -1
- package/dist/ViteMCP.cjs +12 -8
- package/dist/ViteMCP.cjs.map +1 -1
- package/dist/ViteMCP.d.cts +2 -2
- package/dist/ViteMCP.d.ts +2 -2
- package/dist/ViteMCP.js +11 -7
- package/dist/ViteMCP.js.map +1 -1
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-XZBHP34C.js → chunk-INI5RROX.js} +96 -9
- package/dist/chunk-INI5RROX.js.map +1 -0
- package/dist/{chunk-XC4BVJQZ.cjs → chunk-UTQ425O2.cjs} +96 -9
- package/dist/chunk-UTQ425O2.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-XC4BVJQZ.cjs.map +0 -1
- package/dist/chunk-XZBHP34C.js.map +0 -1
package/dist/auth/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkUTQ425O2cjs = require('../chunk-UTQ425O2.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -51,5 +51,5 @@ var _chunkXC4BVJQZcjs = require('../chunk-XC4BVJQZ.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
exports.AuthProvider =
|
|
54
|
+
exports.AuthProvider = _chunkUTQ425O2cjs.AuthProvider; exports.AzureProvider = _chunkUTQ425O2cjs.AzureProvider; exports.ConsentManager = _chunkUTQ425O2cjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkUTQ425O2cjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkUTQ425O2cjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkUTQ425O2cjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkUTQ425O2cjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkUTQ425O2cjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkUTQ425O2cjs.DiskStore; exports.EncryptedTokenStorage = _chunkUTQ425O2cjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkUTQ425O2cjs.GitHubProvider; exports.GoogleProvider = _chunkUTQ425O2cjs.GoogleProvider; exports.JWKSVerifier = _chunkUTQ425O2cjs.JWKSVerifier; exports.JWTIssuer = _chunkUTQ425O2cjs.JWTIssuer; exports.MemoryTokenStorage = _chunkUTQ425O2cjs.MemoryTokenStorage; exports.OAuthProvider = _chunkUTQ425O2cjs.OAuthProvider; exports.OAuthProxy = _chunkUTQ425O2cjs.OAuthProxy; exports.OAuthProxyError = _chunkUTQ425O2cjs.OAuthProxyError; exports.PKCEUtils = _chunkUTQ425O2cjs.PKCEUtils; exports.getAuthSession = _chunkUTQ425O2cjs.getAuthSession; exports.requireAll = _chunkUTQ425O2cjs.requireAll; exports.requireAny = _chunkUTQ425O2cjs.requireAny; exports.requireAuth = _chunkUTQ425O2cjs.requireAuth; exports.requireRole = _chunkUTQ425O2cjs.requireRole; exports.requireScopes = _chunkUTQ425O2cjs.requireScopes;
|
|
55
55
|
//# sourceMappingURL=index.cjs.map
|
package/dist/auth/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-
|
|
2
|
-
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-CWBi3c3D.cjs';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-CWBi3c3D.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Consent Management
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-
|
|
2
|
-
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-CWBi3c3D.js';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-CWBi3c3D.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Consent Management
|
package/dist/auth/index.js
CHANGED
|
@@ -2318,13 +2318,54 @@ var OAuthProxy = class {
|
|
|
2318
2318
|
return response;
|
|
2319
2319
|
}
|
|
2320
2320
|
/**
|
|
2321
|
-
* Match URI against pattern
|
|
2321
|
+
* Match a parsed URI against an allow-list pattern, one URI component at a
|
|
2322
|
+
* time: scheme, host, port, then everything from the path onwards. A `*`
|
|
2323
|
+
* therefore stops where its component stops.
|
|
2324
|
+
*
|
|
2325
|
+
* That containment is the whole point. Matching the pattern against the raw
|
|
2326
|
+
* string let a wildcard run straight through the delimiters that decide
|
|
2327
|
+
* where the browser actually navigates:
|
|
2328
|
+
*
|
|
2329
|
+
* - `http://localhost:*` matched `http://localhost:@evil.com/cb`, where
|
|
2330
|
+
* `localhost:` is userinfo and the real host is `evil.com`.
|
|
2331
|
+
* - `https://*.example.com/*` matched
|
|
2332
|
+
* `https://evil.com/a.example.com/cb`, because the wildcard covered
|
|
2333
|
+
* `evil.com/a` — authority and path at once.
|
|
2334
|
+
*
|
|
2335
|
+
* Both register cleanly under the old matcher, and `handleCallback()` would
|
|
2336
|
+
* then 302 a fresh authorization code to the attacker's host: the CWE-601
|
|
2337
|
+
* theft path this allow-list exists to close. Comparing against `URL`'s
|
|
2338
|
+
* parse makes the delimiters structural rather than incidental, so no
|
|
2339
|
+
* pattern can span them however it is written.
|
|
2340
|
+
*
|
|
2341
|
+
* A pattern that omits the path (`http://localhost:*`, the loopback default)
|
|
2342
|
+
* constrains scheme, host and port only — an ephemeral client chooses its
|
|
2343
|
+
* own callback path. Write a path to pin one.
|
|
2322
2344
|
*/
|
|
2323
2345
|
matchesPattern(uri, pattern) {
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2346
|
+
const parsed = parseUriPattern(pattern);
|
|
2347
|
+
if (!parsed) {
|
|
2348
|
+
return false;
|
|
2349
|
+
}
|
|
2350
|
+
if (uri.protocol.slice(0, -1) !== parsed.scheme) {
|
|
2351
|
+
return false;
|
|
2352
|
+
}
|
|
2353
|
+
if (parsed.authority) {
|
|
2354
|
+
if (!globComponent(parsed.authority.host).test(uri.hostname)) {
|
|
2355
|
+
return false;
|
|
2356
|
+
}
|
|
2357
|
+
if (!globComponent(parsed.authority.port).test(uri.port)) {
|
|
2358
|
+
return false;
|
|
2359
|
+
}
|
|
2360
|
+
} else if (uri.host !== "") {
|
|
2361
|
+
return false;
|
|
2362
|
+
}
|
|
2363
|
+
if (parsed.rest === "") {
|
|
2364
|
+
return true;
|
|
2365
|
+
}
|
|
2366
|
+
return globComponent(parsed.rest).test(
|
|
2367
|
+
`${uri.pathname}${uri.search}${uri.hash}`
|
|
2326
2368
|
);
|
|
2327
|
-
return regex.test(uri);
|
|
2328
2369
|
}
|
|
2329
2370
|
/**
|
|
2330
2371
|
* Parse token response that can be either JSON or URL-encoded
|
|
@@ -2548,11 +2589,15 @@ var OAuthProxy = class {
|
|
|
2548
2589
|
* theft. Do not loosen the default beyond loopback addresses.
|
|
2549
2590
|
*/
|
|
2550
2591
|
validateRedirectUri(uri) {
|
|
2592
|
+
let url;
|
|
2551
2593
|
try {
|
|
2552
|
-
new URL(uri);
|
|
2594
|
+
url = new URL(uri);
|
|
2553
2595
|
} catch {
|
|
2554
2596
|
return false;
|
|
2555
2597
|
}
|
|
2598
|
+
if (url.username !== "" || url.password !== "") {
|
|
2599
|
+
return false;
|
|
2600
|
+
}
|
|
2556
2601
|
const patterns = this.config.allowedRedirectUriPatterns;
|
|
2557
2602
|
if (Array.isArray(patterns) && patterns.length === 0) {
|
|
2558
2603
|
return false;
|
|
@@ -2562,10 +2607,49 @@ var OAuthProxy = class {
|
|
|
2562
2607
|
"http://127.0.0.1:*"
|
|
2563
2608
|
];
|
|
2564
2609
|
return effectivePatterns.some(
|
|
2565
|
-
(pattern) => this.matchesPattern(
|
|
2610
|
+
(pattern) => this.matchesPattern(url, pattern)
|
|
2566
2611
|
);
|
|
2567
2612
|
}
|
|
2568
2613
|
};
|
|
2614
|
+
var globComponent = (glob) => {
|
|
2615
|
+
const source = glob.replace(/[.*+?^${}()|[\]\\]/g, (character) => {
|
|
2616
|
+
if (character === "*") {
|
|
2617
|
+
return ".*";
|
|
2618
|
+
}
|
|
2619
|
+
if (character === "?") {
|
|
2620
|
+
return ".";
|
|
2621
|
+
}
|
|
2622
|
+
return `\\${character}`;
|
|
2623
|
+
});
|
|
2624
|
+
return new RegExp(`^${source}$`);
|
|
2625
|
+
};
|
|
2626
|
+
var parseUriPattern = (pattern) => {
|
|
2627
|
+
const schemeEnd = pattern.indexOf(":");
|
|
2628
|
+
if (schemeEnd <= 0) {
|
|
2629
|
+
return null;
|
|
2630
|
+
}
|
|
2631
|
+
const scheme = pattern.slice(0, schemeEnd).toLowerCase();
|
|
2632
|
+
const afterScheme = pattern.slice(schemeEnd + 1);
|
|
2633
|
+
if (!afterScheme.startsWith("//")) {
|
|
2634
|
+
return { authority: null, rest: afterScheme, scheme };
|
|
2635
|
+
}
|
|
2636
|
+
const hierarchical = afterScheme.slice(2);
|
|
2637
|
+
const restStart = hierarchical.search(/[#/?]/);
|
|
2638
|
+
const authority = restStart === -1 ? hierarchical : hierarchical.slice(0, restStart);
|
|
2639
|
+
if (authority.includes("@")) {
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
const hostEnd = authority.startsWith("[") ? authority.indexOf("]") + 1 : 0;
|
|
2643
|
+
const portSeparator = authority.indexOf(":", hostEnd);
|
|
2644
|
+
return {
|
|
2645
|
+
authority: {
|
|
2646
|
+
host: (portSeparator === -1 ? authority : authority.slice(0, portSeparator)).toLowerCase(),
|
|
2647
|
+
port: portSeparator === -1 ? "" : authority.slice(portSeparator + 1)
|
|
2648
|
+
},
|
|
2649
|
+
rest: restStart === -1 ? "" : hierarchical.slice(restStart),
|
|
2650
|
+
scheme
|
|
2651
|
+
};
|
|
2652
|
+
};
|
|
2569
2653
|
var isLoopbackRedirectUri = (uri) => {
|
|
2570
2654
|
try {
|
|
2571
2655
|
const url = new URL(uri);
|
|
@@ -2958,7 +3042,10 @@ var DiskStore = class {
|
|
|
2958
3042
|
value
|
|
2959
3043
|
};
|
|
2960
3044
|
try {
|
|
2961
|
-
await writeFile(filePath, JSON.stringify(entry, null, 2),
|
|
3045
|
+
await writeFile(filePath, JSON.stringify(entry, null, 2), {
|
|
3046
|
+
encoding: "utf-8",
|
|
3047
|
+
mode: 384
|
|
3048
|
+
});
|
|
2962
3049
|
} catch (error) {
|
|
2963
3050
|
console.error(`Failed to save key ${key}:`, error);
|
|
2964
3051
|
throw error;
|
|
@@ -3017,7 +3104,7 @@ var DiskStore = class {
|
|
|
3017
3104
|
}
|
|
3018
3105
|
} catch (error) {
|
|
3019
3106
|
if (error.code === "ENOENT") {
|
|
3020
|
-
await mkdir(this.directory, { recursive: true });
|
|
3107
|
+
await mkdir(this.directory, { mode: 448, recursive: true });
|
|
3021
3108
|
} else {
|
|
3022
3109
|
throw error;
|
|
3023
3110
|
}
|
|
@@ -3196,4 +3283,4 @@ export {
|
|
|
3196
3283
|
DiskStore,
|
|
3197
3284
|
JWKSVerifier
|
|
3198
3285
|
};
|
|
3199
|
-
//# sourceMappingURL=chunk-
|
|
3286
|
+
//# sourceMappingURL=chunk-INI5RROX.js.map
|