toolcraft 0.0.349 → 0.0.350

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/composition.json CHANGED
@@ -98,7 +98,7 @@
98
98
  },
99
99
  {
100
100
  "name": "tiny-http-mcp-server",
101
- "version": "0.1.78",
101
+ "version": "0.1.80",
102
102
  "license": "MIT"
103
103
  },
104
104
  {
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "toolcraft",
116
- "version": "0.0.349",
116
+ "version": "0.0.350",
117
117
  "license": "MIT"
118
118
  },
119
119
  {
@@ -123,7 +123,7 @@
123
123
  },
124
124
  {
125
125
  "name": "toolcraft-schema",
126
- "version": "0.0.349",
126
+ "version": "0.0.350",
127
127
  "license": "MIT"
128
128
  },
129
129
  {
@@ -98,7 +98,7 @@
98
98
  },
99
99
  {
100
100
  "name": "tiny-http-mcp-server",
101
- "version": "0.1.78",
101
+ "version": "0.1.80",
102
102
  "license": "MIT"
103
103
  },
104
104
  {
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "toolcraft",
116
- "version": "0.0.349",
116
+ "version": "0.0.350",
117
117
  "license": "MIT"
118
118
  },
119
119
  {
@@ -123,7 +123,7 @@
123
123
  },
124
124
  {
125
125
  "name": "toolcraft-schema",
126
- "version": "0.0.349",
126
+ "version": "0.0.350",
127
127
  "license": "MIT"
128
128
  },
129
129
  {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "name": "tiny-http-mcp-server",
21
- "version": "0.1.78",
21
+ "version": "0.1.80",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -61,12 +61,16 @@ alone do not establish either native error type.
61
61
  - `browser.timeoutMs` optional authorization deadline (default 120,000 ms)
62
62
  - `sessionStore` optional
63
63
  - `authStore` optional `auth-store` backend config for the default session store
64
- - `now()` optional clock override
64
+ - `now()` optional clock override returning integer Unix epoch milliseconds within the JavaScript Date range
65
65
 
66
66
  The default provider captures client, interaction, callback, landing-page and
67
67
  lock policies when created. Create a new provider to change those settings.
68
68
  Selected callbacks, stores, clocks and AbortSignals remain live host dependencies;
69
69
  aborting the original signal still cancels authorization.
70
+ An invalid clock fails before attaching or refreshing a grant with a known
71
+ expiry or redeeming a time-limited client secret. Unknown access lifetimes and
72
+ unlimited secret lifetimes do not require a clock read. Valid negative epoch
73
+ times remain supported.
70
74
  Native session and client persistence factories also capture file paths, salts,
71
75
  Keychain identities, lock locations and selected filesystem/command handles.
72
76
  Mutating these settings cannot redirect a later read or write.
@@ -94,6 +98,9 @@ authorization and code exchange. Credentials, fragments, port zero and reserved
94
98
  OAuth callback query parameters, including `error_uri`, are rejected before binding a listener.
95
99
  Fragment rejection includes a trailing empty `#`. Empty queries and percent-escaped
96
100
  hash data remain valid and keep their exact registered spelling.
101
+ Direct initial grants and host-supplied or stored authorization, token and
102
+ registration endpoints also reject empty fragment components before consent or
103
+ credential redemption. Percent-escaped hashes remain ordinary path/query data.
97
104
  `createDefaultOAuthClientProvider` also checks the configured redirect before
98
105
  creating the provider. Imported tokens that cannot be sent as HTTP header
99
106
  values fail with diagnostics that omit their contents. Omit
@@ -40,7 +40,13 @@ export function createDefaultOAuthClientProvider(options) {
40
40
  const sessionStore = resourceStores?.sessionStore ?? options.sessionStore ?? createAuthStoreSessionStore(options.authStore, options.persistenceNamespace);
41
41
  const clientStore = resourceStores?.clientStore ??
42
42
  (options.authStore === undefined ? null : createAuthStoreClientStore(options.authStore, options.persistenceNamespace));
43
- const now = options.now ?? Date.now;
43
+ const clock = options.now ?? Date.now;
44
+ const now = () => {
45
+ const timestamp = clock();
46
+ if (!Number.isSafeInteger(timestamp) || Math.abs(timestamp) > MAX_JS_DATE_MS)
47
+ throw new Error("OAuth clock must return valid epoch milliseconds");
48
+ return timestamp;
49
+ };
44
50
  const registeredClients = new Map();
45
51
  if (options.initialGrant !== undefined) {
46
52
  let resource;
@@ -50,7 +56,7 @@ export function createDefaultOAuthClientProvider(options) {
50
56
  catch {
51
57
  throw new Error("OAuth initial grant resource must be an absolute HTTP URL");
52
58
  }
53
- if ((resource.protocol !== "http:" && resource.protocol !== "https:") || resource.username || resource.password || resource.hash)
59
+ if ((resource.protocol !== "http:" && resource.protocol !== "https:") || resource.username || resource.password || resource.href.includes("#"))
54
60
  throw new Error("OAuth initial grant resource must be an HTTP URL without credentials or fragments");
55
61
  }
56
62
  const initialGrant = options.initialGrant === undefined ? undefined : {
@@ -756,7 +762,7 @@ function isLoopbackHostname(hostname) {
756
762
  }
757
763
  function assertSecureUrl(value, label) {
758
764
  const url = new URL(value);
759
- if (url.username !== "" || url.password !== "" || url.hash !== "") {
765
+ if (url.username !== "" || url.password !== "" || url.href.includes("#")) {
760
766
  throw new Error(`${label} must not include credentials or fragment`);
761
767
  }
762
768
  if (url.protocol === "https:") {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -5335,7 +5335,13 @@ function createDefaultOAuthClientProvider(options) {
5335
5335
  const resourceStores = options.resourceIdentity === void 0 ? void 0 : createResourceBoundOAuthStores(options.authStore ?? {}, options.persistenceNamespace, options.resourceIdentity);
5336
5336
  const sessionStore = resourceStores?.sessionStore ?? options.sessionStore ?? createAuthStoreSessionStore(options.authStore, options.persistenceNamespace);
5337
5337
  const clientStore = resourceStores?.clientStore ?? (options.authStore === void 0 ? null : createAuthStoreClientStore(options.authStore, options.persistenceNamespace));
5338
- const now = options.now ?? Date.now;
5338
+ const clock = options.now ?? Date.now;
5339
+ const now = () => {
5340
+ const timestamp = clock();
5341
+ if (!Number.isSafeInteger(timestamp) || Math.abs(timestamp) > MAX_JS_DATE_MS3)
5342
+ throw new Error("OAuth clock must return valid epoch milliseconds");
5343
+ return timestamp;
5344
+ };
5339
5345
  const registeredClients = /* @__PURE__ */ new Map();
5340
5346
  if (options.initialGrant !== void 0) {
5341
5347
  let resource;
@@ -5344,7 +5350,7 @@ function createDefaultOAuthClientProvider(options) {
5344
5350
  } catch {
5345
5351
  throw new Error("OAuth initial grant resource must be an absolute HTTP URL");
5346
5352
  }
5347
- if (resource.protocol !== "http:" && resource.protocol !== "https:" || resource.username || resource.password || resource.hash)
5353
+ if (resource.protocol !== "http:" && resource.protocol !== "https:" || resource.username || resource.password || resource.href.includes("#"))
5348
5354
  throw new Error("OAuth initial grant resource must be an HTTP URL without credentials or fragments");
5349
5355
  }
5350
5356
  const initialGrant = options.initialGrant === void 0 ? void 0 : {
@@ -6011,7 +6017,7 @@ function isLoopbackHostname(hostname2) {
6011
6017
  }
6012
6018
  function assertSecureUrl(value, label) {
6013
6019
  const url = new URL2(value);
6014
- if (url.username !== "" || url.password !== "" || url.hash !== "") {
6020
+ if (url.username !== "" || url.password !== "" || url.href.includes("#")) {
6015
6021
  throw new Error(`${label} must not include credentials or fragment`);
6016
6022
  }
6017
6023
  if (url.protocol === "https:") {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "name": "toolcraft-schema",
11
- "version": "0.0.349",
11
+ "version": "0.0.350",
12
12
  "license": "MIT"
13
13
  }
14
14
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-schema",
3
- "version": "0.0.349",
3
+ "version": "0.0.350",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.349",
3
+ "version": "0.0.350",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -158,7 +158,7 @@
158
158
  "yaml"
159
159
  ],
160
160
  "optionalDependencies": {
161
- "toolcraft-schema": "0.0.349",
161
+ "toolcraft-schema": "0.0.350",
162
162
  "toolcraft-design": "*",
163
163
  "@poe-code/frontmatter": "*",
164
164
  "@poe-code/agent-mcp-config": "*",