Files
orca/native/windows-security/index.js
T
Neil 9f62a4fa2d fix(windows): start the WSL holder with only a NUL handle to inherit (#35799)
* fix(windows): start the WSL holder with only a NUL handle to inherit

libuv starts every Windows child with bInheritHandles=TRUE and no handle
list, so a detached holder that outlives Orca kept any inheritable handle
Orca had open, such as a launcher's pipe or a DevTools socket. Start it
through CreateProcessW with PROC_THREAD_ATTRIBUTE_HANDLE_LIST naming one NUL
handle for its stdio. The build probes now check the newest export without
calling it, and the lane receipt labels ConPTY's own startup output.

* fix(windows): report isolated holder exits and kills the way libuv does
2026-10-29 02:56:09 -07:00

27 lines
1.2 KiB
JavaScript

'use strict'
// Load lazily because non-Windows installs have no addon, including during test collection.
let addon = null
function getAddon() {
if (!addon) {
addon = require('./build/Release/orca_windows_security.node')
}
return addon
}
module.exports = {
currentUserSid: () => getAddon().currentUserSid(),
getDaclAces: (path) => getAddon().getDaclAces(path),
setDaclSddl: (path, sddl) => getAddon().setDaclSddl(path, sddl),
setDaclSddlAsync: (path, sddl) => getAddon().setDaclSddlAsync(path, sddl),
createFileWithDacl: (path, sddl, data) => getAddon().createFileWithDacl(path, sddl, data),
grantAccess: (path, sid, mask, options) => getAddon().grantAccess(path, sid, mask, options),
grantAccessAsync: (path, sid, mask, options) =>
getAddon().grantAccessAsync(path, sid, mask, options),
clearStdHandleInheritance: () => getAddon().clearStdHandleInheritance(),
spawnDetachedIsolated: (file, commandLine, cwd, environmentBlock, onExit) =>
getAddon().spawnDetachedIsolated(file, commandLine, cwd, environmentBlock, onExit),
// Reads the binding this package resolved, so a build probe tests the binary the app loads.
hasNativeExport: (name) => typeof getAddon()[name] === 'function'
}