@moxon/api 6.1.0 → 6.2.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.
Files changed (69) hide show
  1. package/README.md +21 -14
  2. package/dist/app.js +5 -3
  3. package/dist/app.js.map +1 -1
  4. package/dist/constants.d.ts +22 -0
  5. package/dist/constants.js +22 -0
  6. package/dist/constants.js.map +1 -1
  7. package/dist/middleware/cors.d.ts +15 -0
  8. package/dist/middleware/cors.js +25 -6
  9. package/dist/middleware/cors.js.map +1 -1
  10. package/dist/middleware/ratelimit.d.ts +53 -1
  11. package/dist/middleware/ratelimit.js +180 -71
  12. package/dist/middleware/ratelimit.js.map +1 -1
  13. package/dist/modules/v4/barcode.d.ts +1 -1
  14. package/dist/modules/v4/barcode.js +9 -2
  15. package/dist/modules/v4/barcode.js.map +1 -1
  16. package/dist/modules/v4/captcha.d.ts +1 -1
  17. package/dist/modules/v4/captcha.js +5 -1
  18. package/dist/modules/v4/captcha.js.map +1 -1
  19. package/dist/modules/v4/chat.js +61 -12
  20. package/dist/modules/v4/chat.js.map +1 -1
  21. package/dist/modules/v4/cron.js +20 -2
  22. package/dist/modules/v4/cron.js.map +1 -1
  23. package/dist/modules/v4/hyperplanning.d.ts +11 -0
  24. package/dist/modules/v4/hyperplanning.js +30 -29
  25. package/dist/modules/v4/hyperplanning.js.map +1 -1
  26. package/dist/modules/v4/qrcode.d.ts +10 -0
  27. package/dist/modules/v4/qrcode.js +138 -14
  28. package/dist/modules/v4/qrcode.js.map +1 -1
  29. package/dist/modules/v4/regex.d.ts +1 -1
  30. package/dist/modules/v4/regex.js +67 -22
  31. package/dist/modules/v4/regex.js.map +1 -1
  32. package/dist/modules/v4/tic_tac_toe.js +56 -15
  33. package/dist/modules/v4/tic_tac_toe.js.map +1 -1
  34. package/dist/modules/v5/asymmetric.d.ts +15 -0
  35. package/dist/modules/v5/asymmetric.js +67 -5
  36. package/dist/modules/v5/asymmetric.js.map +1 -1
  37. package/dist/modules/v5/barcode.d.ts +1 -1
  38. package/dist/modules/v5/barcode.js +9 -2
  39. package/dist/modules/v5/barcode.js.map +1 -1
  40. package/dist/modules/v5/captcha.d.ts +12 -4
  41. package/dist/modules/v5/captcha.js +25 -8
  42. package/dist/modules/v5/captcha.js.map +1 -1
  43. package/dist/modules/v5/chat.js +66 -17
  44. package/dist/modules/v5/chat.js.map +1 -1
  45. package/dist/modules/v5/cron.d.ts +26 -0
  46. package/dist/modules/v5/cron.js +356 -0
  47. package/dist/modules/v5/cron.js.map +1 -0
  48. package/dist/modules/v5/pow.js +1 -1
  49. package/dist/modules/v5/pow.js.map +1 -1
  50. package/dist/modules/v5/tic_tac_toe.js +61 -20
  51. package/dist/modules/v5/tic_tac_toe.js.map +1 -1
  52. package/dist/modules/v5.d.ts +3 -2
  53. package/dist/modules/v5.js +3 -2
  54. package/dist/modules/v5.js.map +1 -1
  55. package/dist/routes/post.js +12 -5
  56. package/dist/routes/post.js.map +1 -1
  57. package/dist/storage/index.js +9 -8
  58. package/dist/storage/index.js.map +1 -1
  59. package/dist/types/storage.d.ts +4 -0
  60. package/dist/utils/challenge.d.ts +5 -3
  61. package/dist/utils/challenge.js +52 -6
  62. package/dist/utils/challenge.js.map +1 -1
  63. package/dist/utils/helpers.d.ts +18 -0
  64. package/dist/utils/helpers.js +35 -1
  65. package/dist/utils/helpers.js.map +1 -1
  66. package/dist/utils/remote.d.ts +42 -0
  67. package/dist/utils/remote.js +313 -0
  68. package/dist/utils/remote.js.map +1 -0
  69. package/package.json +1 -1
@@ -0,0 +1,313 @@
1
+ import { lookup } from 'node:dns/promises';
2
+ import { Agent, request as httpsRequest } from 'node:https';
3
+ import { BlockList, isIP } from 'node:net';
4
+ import { pipeline } from 'node:stream';
5
+ import { constants, createBrotliDecompress, createGunzip, createInflate } from 'node:zlib';
6
+ import { MAX_REMOTE_REDIRECTS } from '../constants.js';
7
+ // Default messages; network and timeout keep the wording fetch() used before this helper
8
+ const MESSAGES = {
9
+ blocked: 'Access to private/internal hosts is not allowed.',
10
+ protocol: 'Only HTTPS URLs are allowed.',
11
+ size: 'Response body is too large.',
12
+ network: 'fetch failed',
13
+ timeout: 'The operation was aborted due to timeout',
14
+ };
15
+ // Same request headers as Node's built-in fetch, so remote servers answer as before
16
+ const HEADERS = {
17
+ accept: '*/*',
18
+ 'accept-language': '*',
19
+ 'sec-fetch-mode': 'cors',
20
+ 'user-agent': 'node',
21
+ 'accept-encoding': 'gzip, deflate',
22
+ };
23
+ const BLOCKED_HOSTS = new Set(['localhost', 'metadata.google.internal']);
24
+ const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
25
+ // Shared so repeated fetches reuse a socket; a pooled socket only ever connected to a vetted address
26
+ const AGENT = new Agent({ keepAlive: true });
27
+ // Loopback, private, link-local, CGNAT, unspecified, multicast, documentation, relay and reserved ranges
28
+ const PRIVATE_RANGES = new BlockList();
29
+ for (const [network, prefix] of [
30
+ ['0.0.0.0', 8],
31
+ ['10.0.0.0', 8],
32
+ ['100.64.0.0', 10],
33
+ ['127.0.0.0', 8],
34
+ ['169.254.0.0', 16],
35
+ ['172.16.0.0', 12],
36
+ ['192.0.0.0', 24],
37
+ ['192.0.2.0', 24],
38
+ ['192.88.99.0', 24],
39
+ ['192.168.0.0', 16],
40
+ ['198.18.0.0', 15],
41
+ ['198.51.100.0', 24],
42
+ ['203.0.113.0', 24],
43
+ ['224.0.0.0', 4],
44
+ ['240.0.0.0', 4],
45
+ ]) {
46
+ PRIVATE_RANGES.addSubnet(network, prefix, 'ipv4');
47
+ }
48
+ // 6to4 and Teredo embed an IPv4 address reached through a relay, so they are refused as a whole
49
+ for (const [network, prefix] of [
50
+ ['::', 96],
51
+ ['::ffff:0:0:0', 96],
52
+ ['64:ff9b:1::', 48],
53
+ ['100::', 64],
54
+ ['2001::', 32],
55
+ ['2001:db8::', 32],
56
+ ['2002::', 16],
57
+ ['fc00::', 7],
58
+ ['fe80::', 10],
59
+ ['fec0::', 10],
60
+ ['ff00::', 8],
61
+ ]) {
62
+ PRIVATE_RANGES.addSubnet(network, prefix, 'ipv6');
63
+ }
64
+ /**
65
+ * Tells whether an IP address belongs to a private, loopback or otherwise internal range.
66
+ *
67
+ * @param address - IPv4 or IPv6 address, optionally with an IPv6 zone index
68
+ * @param blocklist - Ranges to reject, the internal ranges by default
69
+ * @returns true when the address must not be contacted
70
+ */
71
+ export function isPrivateAddress(address, blocklist = PRIVATE_RANGES) {
72
+ const bare = address.split('%')[0];
73
+ const family = isIP(bare);
74
+ if (family === 0)
75
+ return true;
76
+ if (family === 4)
77
+ return blocklist.check(bare, 'ipv4');
78
+ if (blocklist.check(bare, 'ipv6'))
79
+ return true;
80
+ // IPv4-mapped addresses are matched by BlockList itself, NAT64 ones are not
81
+ const nat64 = /^\[64:ff9b::(?:([0-9a-f]{1,4}):)?([0-9a-f]{1,4})?\]$/.exec(new URL(`http://[${bare}]`).hostname);
82
+ if (!nat64)
83
+ return false;
84
+ const value = (parseInt(nat64[1] ?? '0', 16) << 16) | parseInt(nat64[2] ?? '0', 16);
85
+ const embedded = [24, 16, 8, 0].map((shift) => (value >>> shift) & 255).join('.');
86
+ return blocklist.check(embedded, 'ipv4');
87
+ }
88
+ /**
89
+ * Builds the error thrown for a failed remote fetch.
90
+ *
91
+ * @param kind - Failure category
92
+ * @param messages - Caller overrides for the user-facing messages
93
+ * @returns Error carrying the caller's message, or the default one for that category
94
+ */
95
+ function failure(kind, messages) {
96
+ return new Error(messages?.[kind] ?? MESSAGES[kind]);
97
+ }
98
+ /**
99
+ * Parses a URL to fetch and enforces HTTPS without credentials.
100
+ *
101
+ * @param url - Absolute URL, or a redirect location relative to base
102
+ * @param messages - Caller overrides for the user-facing messages
103
+ * @param base - URL of the response that redirected, if any
104
+ * @returns Parsed URL
105
+ */
106
+ function parse(url, messages, base) {
107
+ let parsed;
108
+ try {
109
+ parsed = new URL(url, base);
110
+ }
111
+ catch {
112
+ throw base ? failure('network', messages) : new Error(`Failed to parse URL from ${url}`);
113
+ }
114
+ if (parsed.protocol !== 'https:')
115
+ throw failure('protocol', messages);
116
+ if (parsed.username || parsed.password) {
117
+ throw base
118
+ ? failure('network', messages)
119
+ : new Error(`Request cannot be constructed from a URL that includes credentials: ${url}`);
120
+ }
121
+ return parsed;
122
+ }
123
+ /**
124
+ * Resolves a hostname with the system resolver, returning every address.
125
+ *
126
+ * @param hostname - Hostname to resolve
127
+ * @returns All addresses the hostname resolves to
128
+ */
129
+ function resolveHost(hostname) {
130
+ return lookup(hostname, { all: true });
131
+ }
132
+ /**
133
+ * Resolves the URL host once and rejects it when any of its addresses is internal.
134
+ *
135
+ * @param url - URL about to be fetched
136
+ * @param options - Fetch options holding the blocklist, resolver and messages
137
+ * @returns The vetted addresses, which are the only ones the connection may use
138
+ */
139
+ async function vet(url, options) {
140
+ const host = url.hostname.replace(/^\[|\]$/g, '').replace(/\.$/, '');
141
+ if (BLOCKED_HOSTS.has(host) || host.endsWith('.localhost'))
142
+ throw failure('blocked', options.messages);
143
+ const family = isIP(host);
144
+ let addresses;
145
+ if (family) {
146
+ addresses = [{ address: host, family }];
147
+ }
148
+ else {
149
+ try {
150
+ addresses = await (options.resolve ?? resolveHost)(host);
151
+ }
152
+ catch {
153
+ throw failure('network', options.messages);
154
+ }
155
+ }
156
+ const blocklist = options.blocklist ?? PRIVATE_RANGES;
157
+ if (!addresses.length || addresses.some(({ address }) => isPrivateAddress(address, blocklist))) {
158
+ throw failure('blocked', options.messages);
159
+ }
160
+ return addresses;
161
+ }
162
+ /**
163
+ * Sends one GET request whose socket can only connect to the vetted addresses.
164
+ *
165
+ * @param url - URL to request
166
+ * @param addresses - Addresses returned by vet()
167
+ * @param options - Fetch options holding the transport and messages
168
+ * @param signal - Signal aborting the request on timeout
169
+ * @returns The response, before its body is read
170
+ */
171
+ function send(url, addresses, options, signal) {
172
+ // Pinning the lookup stops a second DNS answer (rebinding) from changing the target
173
+ const pinned = (_hostname, lookupOptions, callback) => {
174
+ if (lookupOptions.all)
175
+ callback(null, addresses);
176
+ else
177
+ callback(null, addresses[0].address, addresses[0].family);
178
+ };
179
+ return new Promise((resolve, reject) => {
180
+ const req = (options.request ?? httpsRequest)(url, { method: 'GET', headers: HEADERS, lookup: pinned, agent: AGENT, signal }, resolve);
181
+ req.on('error', () => reject(failure('network', options.messages)));
182
+ req.end();
183
+ });
184
+ }
185
+ /**
186
+ * Builds the decompression stages for a Content-Encoding header, like fetch() does.
187
+ *
188
+ * @param header - Content-Encoding header value
189
+ * @returns Decoders to apply in order, or none when an encoding is unknown
190
+ */
191
+ function decoders(header) {
192
+ const codings = (header ?? '')
193
+ .toLowerCase()
194
+ .split(',')
195
+ .map((c) => c.trim())
196
+ .filter(Boolean);
197
+ const zlib = { flush: constants.Z_SYNC_FLUSH, finishFlush: constants.Z_SYNC_FLUSH };
198
+ const brotli = { flush: constants.BROTLI_OPERATION_FLUSH, finishFlush: constants.BROTLI_OPERATION_FLUSH };
199
+ const stages = [];
200
+ for (const coding of codings.reverse()) {
201
+ if (coding === 'gzip' || coding === 'x-gzip')
202
+ stages.push(createGunzip(zlib));
203
+ else if (coding === 'deflate')
204
+ stages.push(createInflate(zlib));
205
+ else if (coding === 'br')
206
+ stages.push(createBrotliDecompress(brotli));
207
+ else
208
+ return [];
209
+ }
210
+ return stages;
211
+ }
212
+ /**
213
+ * Reads a decoded response body and aborts as soon as it grows past the limit.
214
+ *
215
+ * @param response - Response to read
216
+ * @param maxBytes - Largest decoded body accepted
217
+ * @param messages - Caller overrides for the user-facing messages
218
+ * @returns The decoded body
219
+ */
220
+ async function readBody(response, maxBytes, messages) {
221
+ const stages = decoders(response.headers['content-encoding']);
222
+ const stream = stages.length ? pipeline([response, ...stages], () => { }) : response;
223
+ const chunks = [];
224
+ let size = 0;
225
+ try {
226
+ for await (const chunk of stream) {
227
+ size += chunk.length;
228
+ if (size > maxBytes)
229
+ break;
230
+ chunks.push(chunk);
231
+ }
232
+ }
233
+ catch {
234
+ throw failure('network', messages);
235
+ }
236
+ finally {
237
+ response.destroy();
238
+ }
239
+ if (size > maxBytes)
240
+ throw failure('size', messages);
241
+ return Buffer.concat(chunks);
242
+ }
243
+ /**
244
+ * Follows the redirect chain by hand, vetting every hop, then reads the final body.
245
+ *
246
+ * @param url - URL to fetch
247
+ * @param options - Fetch options
248
+ * @param signal - Signal aborted on timeout
249
+ * @returns The decoded body of the final response
250
+ */
251
+ async function download(url, options, signal) {
252
+ const redirects = options.redirects ?? MAX_REMOTE_REDIRECTS;
253
+ let target = parse(url, options.messages);
254
+ for (let hop = 0;; hop++) {
255
+ const addresses = await vet(target, options);
256
+ if (signal.aborted)
257
+ throw failure('timeout', options.messages);
258
+ const response = await send(target, addresses, options, signal);
259
+ const status = response.statusCode ?? 0;
260
+ const location = response.headers.location;
261
+ if (REDIRECT_STATUSES.has(status) && location) {
262
+ response.destroy();
263
+ if (hop >= redirects)
264
+ throw failure('network', options.messages);
265
+ target = parse(location, options.messages, target);
266
+ continue;
267
+ }
268
+ try {
269
+ options.check?.({
270
+ status,
271
+ ok: status >= 200 && status <= 299,
272
+ contentType: response.headers['content-type'] ?? '',
273
+ });
274
+ }
275
+ catch (err) {
276
+ response.destroy();
277
+ throw err;
278
+ }
279
+ return readBody(response, options.maxBytes, options.messages);
280
+ }
281
+ }
282
+ /**
283
+ * Fetches an HTTPS resource without letting the caller reach internal hosts.
284
+ *
285
+ * The host is resolved once, every address is checked against the internal ranges, and the
286
+ * socket connects to those vetted addresses only. Redirects are followed by hand with the same
287
+ * checks on each hop, the body is streamed and cut past maxBytes, and the whole exchange,
288
+ * redirects and body included, must finish within the timeout.
289
+ *
290
+ * @param url - HTTPS URL to fetch
291
+ * @param options - Size limit, timeout, response check and test seams
292
+ * @returns The decoded response body
293
+ * @throws Error if the URL is invalid or internal, the transfer fails, times out or is too large, or check throws
294
+ */
295
+ export async function fetchRemote(url, options) {
296
+ const controller = new AbortController();
297
+ const timer = setTimeout(() => controller.abort(), options.timeout).unref();
298
+ const expired = new Promise((_, reject) => {
299
+ controller.signal.addEventListener('abort', () => reject(failure('timeout', options.messages)), {
300
+ once: true,
301
+ });
302
+ });
303
+ try {
304
+ return await Promise.race([download(url, options, controller.signal), expired]);
305
+ }
306
+ catch (err) {
307
+ throw controller.signal.aborted ? failure('timeout', options.messages) : err;
308
+ }
309
+ finally {
310
+ clearTimeout(timer);
311
+ }
312
+ }
313
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/utils/remote.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAuBvD,yFAAyF;AACzF,MAAM,QAAQ,GAAkC;IAC5C,OAAO,EAAE,kDAAkD;IAC3D,QAAQ,EAAE,8BAA8B;IACxC,IAAI,EAAE,6BAA6B;IACnC,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,0CAA0C;CACtD,CAAC;AAEF,oFAAoF;AACpF,MAAM,OAAO,GAAG;IACZ,MAAM,EAAE,KAAK;IACb,iBAAiB,EAAE,GAAG;IACtB,gBAAgB,EAAE,MAAM;IACxB,YAAY,EAAE,MAAM;IACpB,iBAAiB,EAAE,eAAe;CACrC,CAAC;AAEF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,CAAC;AACzE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,E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CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACjF,CAAC;YAAS,CAAC;QACP,YAAY,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.1.0",
2
+ "version": "6.2.0",
3
3
  "name": "@moxon/api",
4
4
  "description": "Node.js API with 40+ utilities, usable as a library or over HTTP. Documentation at https://moxon.dev",
5
5
  "main": "./dist/modules/v6.js",