From cfba105ecdb43cc71203770f261fb860d2cf6d2b Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Tue, 28 Mar 2023 16:09:51 +0200 Subject: [PATCH] cross-realm type checks in search --- test/server.test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/server.test.js b/test/server.test.js index 76deb72..d933999 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -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() +})