Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ All notable changes to this Voratiq-maintained fork are documented here.
- Updated fork package metadata and documentation for the Voratiq-maintained release line.
- Allowed macOS sandbox to query `configd` for DNS resolution.
- Added network/fs observability events with scrubbing and spawn‑scoped callbacks.

## 0.0.29-voratiq1 - 2026-01-23

- Avoid non-blocking stdout panics by piping child output when stdout is not a TTY.
- Add host/port context to proxy socket error logs for easier debugging.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@voratiq/sandbox-runtime",
"version": "0.0.29-voratiq0",
"version": "0.0.29-voratiq1",
"description": "(Voratiq-maintained fork of the) Anthropic Sandbox Runtime (ASRT) - A general-purpose tool for wrapping security boundaries around arbitrary processes",
"type": "module",
"main": "./dist/index.js",
Expand Down
7 changes: 6 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,15 @@ async function main(): Promise<void> {
const sandboxedCommand = await SandboxManager.wrapWithSandbox(command)

// Execute the sandboxed command
const shouldPipe = !process.stdout.isTTY
const child = spawn(sandboxedCommand, {
shell: true,
stdio: 'inherit',
stdio: shouldPipe ? ['inherit', 'pipe', 'pipe'] : 'inherit',
})
if (shouldPipe && child.stdout && child.stderr) {
child.stdout.pipe(process.stdout)
child.stderr.pipe(process.stderr)
}

// Handle process exit
child.on('exit', (code, signal) => {
Expand Down
26 changes: 16 additions & 10 deletions src/sandbox/http-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export function createHttpProxyServer(options: HttpProxyServerOptions): Server {
server.on('connect', async (req, socket) => {
// Attach error handler immediately to prevent unhandled errors
socket.on('error', err => {
logForDebugging(`Client socket error: ${err.message}`, { level: 'error' })
logForDebugging(
`Client socket error (CONNECT ${req.url}): ${err.message}`,
{ level: 'error' },
)
})

try {
Expand Down Expand Up @@ -149,9 +152,10 @@ export function createHttpProxyServer(options: HttpProxyServerOptions): Server {
})

socket.on('error', err => {
logForDebugging(`Client socket error: ${err.message}`, {
level: 'error',
})
logForDebugging(
`Client socket error (MITM CONNECT ${hostname}:${port}): ${err.message}`,
{ level: 'error' },
)
mitmSocket.destroy()
})

Expand All @@ -166,16 +170,18 @@ export function createHttpProxyServer(options: HttpProxyServerOptions): Server {
})

serverSocket.on('error', err => {
logForDebugging(`CONNECT tunnel failed: ${err.message}`, {
level: 'error',
})
logForDebugging(
`CONNECT tunnel failed to ${hostname}:${port} - ${err.message}`,
{ level: 'error' },
)
socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n')
})

socket.on('error', err => {
logForDebugging(`Client socket error: ${err.message}`, {
level: 'error',
})
logForDebugging(
`Client socket error (CONNECT ${hostname}:${port}): ${err.message}`,
{ level: 'error' },
)
serverSocket.destroy()
})

Expand Down
4 changes: 2 additions & 2 deletions src/sandbox/socks-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ export function createSocksProxyServer(
})

if (!filterResult.allowed) {
logForDebugging(`Connection blocked to ${hostname}:${port}`, {
logForDebugging(`Connection blocked to ${hostname}:${port} (SOCKS)`, {
level: 'error',
})
return false
}

logForDebugging(`Connection allowed to ${hostname}:${port}`)
logForDebugging(`Connection allowed to ${hostname}:${port} (SOCKS)`)
return true
} catch (error) {
logForDebugging(`Error validating connection: ${error}`, {
Expand Down
Loading