cross-realm type checks in search

This commit is contained in:
Axel Kittenberger 2023-03-28 16:09:51 +02:00 committed by James Sumners
parent 78014a2ea3
commit cfba105ecd
1 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@
const net = require('net')
const tap = require('tap')
const vasync = require('vasync')
const vm = require('node:vm')
const { getSock } = require('./utils')
const ldap = require('../lib')
@ -434,3 +435,16 @@ tap.test('multithreading support via hook', function (t) {
})
})
})
tap.test('cross-realm type checks', function (t) {
const server = ldap.createServer()
const ctx = vm.createContext({})
vm.runInContext(
'globalThis.search=function(){};\n' +
'globalThis.searches=[function(){}];'
, ctx)
server.search('', ctx.search)
server.search('', ctx.searches)
t.ok(server)
t.end()
})