Skip to content

Commit 27354d5

Browse files
committed
fix: test compatibility
1 parent 59ccba9 commit 27354d5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

test/ghsa/GHSA-rp36-8xq3-r6c4/repro.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,17 @@ describe('GHSA-rp36-8xq3-r6c4 — NodeVM builtin denylist bypass', () => {
154154
expectBlocked(vm, "require('inspector/promises')", "explicit inspector/promises allowlist");
155155
});
156156

157-
it('safe builtins still load under "*"', () => {
157+
// `fs/promises` requires Node 14+, `dns/promises` / `stream/promises` are
158+
// Node 15+. The regression we're guarding against (family-prefix check
159+
// shadowing sibling subpath builtins) can only manifest on Node versions
160+
// that actually expose those subpaths, so this test is gated accordingly.
161+
const NODE_MAJOR = parseInt(process.versions.node.split('.')[0], 10);
162+
if (typeof it.cond !== 'function') {
163+
it.cond = function (name, cond, fn) {
164+
return cond ? it(name, fn) : it.skip(name, fn);
165+
};
166+
}
167+
it.cond('safe builtins still load under "*"', NODE_MAJOR >= 15, () => {
158168
// Regression guard: the family-prefix check must not break sibling
159169
// builtins like fs/promises, dns/promises, stream/promises, etc.
160170
const vm = makeVm();

0 commit comments

Comments
 (0)