mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-22 04:05:42 +00:00
* fix(node-vm): scripting context and module resolution issues Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(node-vm): use vm.createContext for true isolation and fix prototype mismatches - Replace vm.compileFunction with vm.createContext + runInContext for true isolation - Remove ECMAScript built-ins from safeGlobals (VM provides its own versions) - This fixes prototype chain mismatches that broke libraries like @faker-js/faker - Add sanitized process object (allows env, blocks exit/kill) - Add global/globalThis pointing to isolated context (not host) - Extract safe globals to constants.js for maintainability - Remove typed-arrays mixin (VM provides TypedArrays) - Add comprehensive isolation tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(node-vm): remove process, add Error types and TypedArrays mixin, add jose test - Remove process object from script context (security hardening) - Remove createSanitizedProcess function from constants.js - Add Error types to safeGlobals for instanceof checks with host errors - Add TypedArrays mixin for host API compatibility (TextEncoder, crypto, Buffer) - Add jose library and test for JWT sign/verify functionality - Update tests to reflect process removal Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(node-vm): handle circular dependencies and failed module caching - Pre-populate module cache before execution to support circular requires - Cache moduleObj instead of moduleObj.exports to handle module.exports reassignment - Remove failed modules from cache to allow retry - Add test for circular dependency handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(node-vm): spread all context properties in buildScriptContext Instead of explicitly listing each context property, spread all properties from the context input to support future additions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(node-vm): add filtered process object to script context Expose a sanitized process object with only safe read-only properties (argv, version, arch, platform, pid, features) while keeping env empty for security. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(node-vm): add comprehensive tests for Node.js builtins Add 18 test files for Node.js builtin APIs in developer sandbox mode: - Buffer, URL, TextEncoder/TextDecoder, btoa/atob - Web Crypto API and node:crypto module - Timers (setTimeout, setInterval, setImmediate, queueMicrotask) - Fetch API (Request, Response, Headers, FormData, Blob) - Intl formatters, JSON, Events (Event, EventTarget, CustomEvent) - Node modules: fs, path, os, util, stream, zlib, querystring All tests skip in safe mode using bru.runner.skipRequest(). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(node-vm): address CodeRabbit review feedback - Block absolute paths from bypassing security by routing through loadLocalModule - Fix process tests to expect sanitized object instead of undefined - Fix cache test to verify module executes only once - Add tests for absolute path handling (block outside, allow within roots) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: lint issues * fix(node-vm): recontextualize host objects for cross-context deep equality Objects passed from the host context into the Node VM have different Object/Array constructors than objects created inside the VM. This breaks deep equality checks in libraries like AJV, where fast-deep-equal fails on `a.constructor !== b.constructor` for structurally identical objects. Add recontextualizeScript to utils.js that wraps getter methods (res.getBody, res.getHeaders, req.getBody, req.getHeaders, req.getPathParams, req.getTags, bru.getVar) to JSON round-trip returned objects inside the VM, giving them VM-native prototypes. Add external-lib-with-bru-req-res-objects package and tests to verify bru/req/res accessibility from npm modules. Update ajv.bru tests to validate res.getBody() against AJV schemas with enum on nested objects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(node-vm): update spec to use saved mock refs after recontextualize The recontextualizeScript wraps res.getBody with a JSON round-trip function, replacing the jest mock on the context object. Save mock references before calling runScriptInNodeVm so assertions work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(node-vm): shallow-copy mutable process properties in sandbox process.argv, process.versions, and process.features were passed by reference, allowing sandboxed scripts to mutate the host process. Shallow-copy these properties to prevent leaking mutable references. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(node-vm): use recursive clone in toVMNative instead of JSON round-trip JSON.stringify converts undefined to null in arrays, breaking tests like res.setBody([..., undefined, ...]). Replace with recursive clone that creates new VM-native objects/arrays while preserving undefined values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(node-vm): generalize recontextualize to wrap all bru/req/res methods Instead of hardcoding specific method names, walk the prototype chain with Object.getOwnPropertyNames to discover and wrap all methods that return Objects/Arrays. Async methods (sendRequest, runRequest) get their resolved values wrapped. The res callable and res.body/res.headers are also recontextualized for direct access and query usage. Adds integration tests for VM-native prototype checks across res, req, bru APIs, res() callable queries, and bru.sendRequest patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * revert(node-vm): remove recontextualizeScript and related tests The recontextualize approach of wrapping all bru/req/res methods to return VM-native objects is being reverted in favor of a different solution to the cross-context prototype mismatch issue. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(node-vm): expose full process object in developer sandbox via safeGlobals * test(node-vm): update process tests for full process object in developer sandbox * test(node-vm): update spec to verify process.nextTick availability --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
258 lines
9.9 KiB
JSON
258 lines
9.9 KiB
JSON
{
|
|
"name": "@usebruno/test-collection",
|
|
"version": "0.0.1",
|
|
"lockfileVersion": 3,
|
|
"requires": true,
|
|
"packages": {
|
|
"": {
|
|
"name": "@usebruno/test-collection",
|
|
"version": "0.0.1",
|
|
"dependencies": {
|
|
"@faker-js/faker": "^8.4.0",
|
|
"ajv": "~8.17.1",
|
|
"external-lib-with-bru-req-res-objects": "file:../external-lib-with-bru-req-res-objects",
|
|
"jose": "^5.2.0",
|
|
"jsonwebtoken": "^9.0.3",
|
|
"lru-map-cache": "^0.1.0"
|
|
}
|
|
},
|
|
"../external-lib-with-bru-req-res-objects": {
|
|
"name": "@usebruno/external-lib-with-bru-req-res-objects",
|
|
"version": "0.0.1"
|
|
},
|
|
"node_modules/@faker-js/faker": {
|
|
"version": "8.4.0",
|
|
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.4.0.tgz",
|
|
"integrity": "sha512-htW87352wzUCdX1jyUQocUcmAaFqcR/w082EC8iP/gtkF0K+aKcBp0hR5Arb7dzR8tQ1TrhE9DNa5EbJELm84w==",
|
|
"funding": [
|
|
{
|
|
"type": "opencollective",
|
|
"url": "https://opencollective.com/fakerjs"
|
|
}
|
|
],
|
|
"engines": {
|
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
|
"npm": ">=6.14.13"
|
|
}
|
|
},
|
|
"node_modules/ajv": {
|
|
"version": "8.17.1",
|
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
|
|
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"fast-deep-equal": "^3.1.3",
|
|
"fast-uri": "^3.0.1",
|
|
"json-schema-traverse": "^1.0.0",
|
|
"require-from-string": "^2.0.2"
|
|
},
|
|
"funding": {
|
|
"type": "github",
|
|
"url": "https://github.com/sponsors/epoberezkin"
|
|
}
|
|
},
|
|
"node_modules/buffer-equal-constant-time": {
|
|
"version": "1.0.1",
|
|
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
|
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
|
|
"license": "BSD-3-Clause"
|
|
},
|
|
"node_modules/ecdsa-sig-formatter": {
|
|
"version": "1.0.11",
|
|
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
|
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
|
"license": "Apache-2.0",
|
|
"dependencies": {
|
|
"safe-buffer": "^5.0.1"
|
|
}
|
|
},
|
|
"node_modules/external-lib-with-bru-req-res-objects": {
|
|
"resolved": "../external-lib-with-bru-req-res-objects",
|
|
"link": true
|
|
},
|
|
"node_modules/fast-deep-equal": {
|
|
"version": "3.1.3",
|
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
|
"license": "MIT"
|
|
},
|
|
"node_modules/fast-uri": {
|
|
"version": "3.1.0",
|
|
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",
|
|
"integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==",
|
|
"funding": [
|
|
{
|
|
"type": "github",
|
|
"url": "https://github.com/sponsors/fastify"
|
|
},
|
|
{
|
|
"type": "opencollective",
|
|
"url": "https://opencollective.com/fastify"
|
|
}
|
|
],
|
|
"license": "BSD-3-Clause"
|
|
},
|
|
"node_modules/jose": {
|
|
"version": "5.10.0",
|
|
"resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz",
|
|
"integrity": "sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==",
|
|
"license": "MIT",
|
|
"funding": {
|
|
"url": "https://github.com/sponsors/panva"
|
|
}
|
|
},
|
|
"node_modules/json-schema-traverse": {
|
|
"version": "1.0.0",
|
|
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
|
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
|
"license": "MIT"
|
|
},
|
|
"node_modules/jsonwebtoken": {
|
|
"version": "9.0.3",
|
|
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",
|
|
"integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"jws": "^4.0.1",
|
|
"lodash.includes": "^4.3.0",
|
|
"lodash.isboolean": "^3.0.3",
|
|
"lodash.isinteger": "^4.0.4",
|
|
"lodash.isnumber": "^3.0.3",
|
|
"lodash.isplainobject": "^4.0.6",
|
|
"lodash.isstring": "^4.0.1",
|
|
"lodash.once": "^4.0.0",
|
|
"ms": "^2.1.1",
|
|
"semver": "^7.5.4"
|
|
},
|
|
"engines": {
|
|
"node": ">=12",
|
|
"npm": ">=6"
|
|
}
|
|
},
|
|
"node_modules/jwa": {
|
|
"version": "2.0.1",
|
|
"resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
|
|
"integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"buffer-equal-constant-time": "^1.0.1",
|
|
"ecdsa-sig-formatter": "1.0.11",
|
|
"safe-buffer": "^5.0.1"
|
|
}
|
|
},
|
|
"node_modules/jws": {
|
|
"version": "4.0.1",
|
|
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
|
|
"integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"jwa": "^2.0.1",
|
|
"safe-buffer": "^5.0.1"
|
|
}
|
|
},
|
|
"node_modules/lodash.includes": {
|
|
"version": "4.3.0",
|
|
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
|
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
|
|
},
|
|
"node_modules/lodash.isboolean": {
|
|
"version": "3.0.3",
|
|
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
|
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
|
|
},
|
|
"node_modules/lodash.isinteger": {
|
|
"version": "4.0.4",
|
|
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
|
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
|
|
},
|
|
"node_modules/lodash.isnumber": {
|
|
"version": "3.0.3",
|
|
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
|
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
|
|
},
|
|
"node_modules/lodash.isplainobject": {
|
|
"version": "4.0.6",
|
|
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
|
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
|
|
},
|
|
"node_modules/lodash.isstring": {
|
|
"version": "4.0.1",
|
|
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
|
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
|
|
},
|
|
"node_modules/lodash.once": {
|
|
"version": "4.1.1",
|
|
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
|
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
|
|
},
|
|
"node_modules/lru-cache": {
|
|
"version": "6.0.0",
|
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
|
"dependencies": {
|
|
"yallist": "^4.0.0"
|
|
},
|
|
"engines": {
|
|
"node": ">=10"
|
|
}
|
|
},
|
|
"node_modules/lru-map-cache": {
|
|
"version": "0.1.0",
|
|
"resolved": "https://registry.npmjs.org/lru-map-cache/-/lru-map-cache-0.1.0.tgz",
|
|
"integrity": "sha512-r1lasvJbg3lrTS37W5h4Ugy9miaWluYqviZGbfH9A6AbjxSDJCtPNqtGr5MRl/RG/EfYrwe07DC4zQEBnY2q4w=="
|
|
},
|
|
"node_modules/ms": {
|
|
"version": "2.1.3",
|
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
|
},
|
|
"node_modules/require-from-string": {
|
|
"version": "2.0.2",
|
|
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
|
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
|
|
"license": "MIT",
|
|
"engines": {
|
|
"node": ">=0.10.0"
|
|
}
|
|
},
|
|
"node_modules/safe-buffer": {
|
|
"version": "5.2.1",
|
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
|
"funding": [
|
|
{
|
|
"type": "github",
|
|
"url": "https://github.com/sponsors/feross"
|
|
},
|
|
{
|
|
"type": "patreon",
|
|
"url": "https://www.patreon.com/feross"
|
|
},
|
|
{
|
|
"type": "consulting",
|
|
"url": "https://feross.org/support"
|
|
}
|
|
]
|
|
},
|
|
"node_modules/semver": {
|
|
"version": "7.6.0",
|
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
|
|
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
|
|
"dependencies": {
|
|
"lru-cache": "^6.0.0"
|
|
},
|
|
"bin": {
|
|
"semver": "bin/semver.js"
|
|
},
|
|
"engines": {
|
|
"node": ">=10"
|
|
}
|
|
},
|
|
"node_modules/yallist": {
|
|
"version": "4.0.0",
|
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
|
}
|
|
}
|
|
}
|