File tree Expand file tree Collapse file tree
test/ghsa/GHSA-rp36-8xq3-r6c4 Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments