Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 18 min read

How FinShield makes Agent tool chains work inside AppContainer

Originally published on FinShield. Recorded experiments, November 29, 2026. 1 Why does making a presentation start so many programs? An Agent completes tasks on a computer by executing programs. Ask it to mak

Originally published on FinShield. Recorded experiments, November 29, 2026.

1 Why does making a presentation start so many programs?

An Agent completes tasks on a computer by executing programs. Ask it to make a presentation from sales spreadsheets and product materials, for example, and it will typically write and run Python or JavaScript to read the materials, process data, generate charts and use libraries to create slides. To inspect the layout, it may also start document-conversion and page-rendering tools, then revise the code and run it again when it finds problems.

Some work stays within Python or JavaScript libraries, such as python-pptx or PptxGenJS. Other steps need external tools for document conversion, page rendering or image processing. When an Agent uses a local MCP service, it must first start the service and then keep exchanging messages over stdin/stdout. Starting a program is only the first step in this tool chain. Subsequent programs must start correctly, receive input, return output and exit when the task finishes. A failure anywhere can stop presentation rendering, inspection and delivery.

This is the compatibility problem a Windows Agent sandbox must address. Python/Node.js calls that completed in ordinary processes encountered device access failures, named-pipe denial and child-process calls that did not return inside AppContainer. We use these observations to explain the gaps in native AC and Microsoft's MXC, and how FinShield keeps the existing execution code working.

2 Why did FinShield choose AppContainer?

At this point, you may wonder why we mentioned AppContainer and what it is. AppContainer, or AC, is Windows' native process-isolation mechanism. It combines a process's application identity and capabilities with system access checks to restrict access to files, the registry, networks and other resources. Even if the current user can access a document, a program running inside AC must also satisfy the applicable authorization requirements. Microsoft's AppContainer permission model

FinShield uses AC as a foundation for Windows protection because it establishes an operating-system-enforced permission boundary while keeping execution local and using existing Windows tools. AC supports existing desktop programs without starting a separate virtual-machine operating system for each task. We can grant directory read/write access and configure network capabilities according to the task, letting the Agent and its tools work under a restricted identity. For the presentation example, that means authorizing access to source materials and output files while controlling access to other resources. Microsoft's guidance for legacy applications ยท Resource isolation

Safety evaluations have already shown strong protective results from FinShield's use of AC and other Windows isolation mechanisms. In camera comparisons involving WorkBuddy, Claude CLI, Codex CLI and DSH, all four programs could previously record video. With FinShield, their capture tools could not connect to the test camera and produced no valid recording. The permission restrictions reached the tool processes that actually accessed the device. Safety camera comparisons

To complete an Agent task, however, the existing tool chain must also work under restricted permissions. Python and Node.js need system resources when starting children, establishing communication and initializing event loops; these operations are also constrained by AC. Microsoft's Microsoft eXecution Container (MXC) packages multiple isolation backends behind SDKs to help applications execute programs in restricted environments. Has it already handled these runtime compatibility problems? We first test native AC, then compare it with an MXC version that supports an AC path.

3 Start with the simplest child-process calls

Set aside the Agent, model and business task for a moment, and test one basic requirement: can one program start another, collect its output and confirm that it exits normally? For example, let Python start another Python that only prints a line, without reading business files or calling external services. We examine synchronous execution, pipe communication, Node children and Python asynchronous children in turn, explaining each failure by the stage it reaches.

3.1 Python starts Python: NUL fails first

The first case uses subprocess.Popen() to start another Python that writes markers to stdout and stderr. stdin=DEVNULL supplies no input; two PIPE values capture normal and error output separately. communicate(timeout=8) waits for completion and reads the results, after which the test checks the exit code and output. The core call is shown below; the complete probe also records process identity and other information:

import subprocess
import sys

p = subprocess.Popen(
    [sys.executable, "-c", "import sys; print('AC_PROBE_OK'); print('AC_PROBE_STDERR', file=sys.stderr)"],
    stdin=subprocess.DEVNULL,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    text=True,
)
stdout, stderr = p.communicate(timeout=8)
assert p.returncode == 0
assert "AC_PROBE_OK" in stdout and "AC_PROBE_STDERR" in stderr

The ordinary-process capture, with identity events omitted and the results organized by output stream, is:

stdout: AC_PROBE_OK
stderr: AC_PROBE_STDERR
returncode: 0

The native AC control did not complete this case. The retained experiment record locates the failure at opening NUL, rather than the output pipe. Its result summary is:

Open NUL: access denied
Popen case: fail

On Windows, DEVNULL refers to the NUL device, which Python must open first. That access was denied, preventing the subsequent child-process call from completing as expected. An ordinary Popen call already depends on system objects outside the script directory.

3.2 Pipe communication: the same parameters, different namespaces

We next test NUL and the pipe types separately so that the first error does not prevent further diagnosis. The probe opens NUL, creates an anonymous pipe, and creates global and LOCAL named pipes. For the named pipes, only the name prefix changes; the remaining parameters stay the same. Run the two calls below separately; the complete probe catches each exception individually:

import _winapi
import uuid

def create_pipe(prefix):
    name = prefix + "ac-probe-" + uuid.uuid4().hex
    handle = _winapi.CreateNamedPipe(
        name, 3 | 0x40000000, 0, 1, 65536, 65536, 0, 0
    )
    _winapi.CloseHandle(handle)

create_pipe("\\\\.\\pipe\\")
create_pipe("\\\\.\\pipe\\LOCAL\\")

3 requests duplex access, and 0x40000000 enables overlapped I/O for asynchronous reads and writes. The observed results are:

Operation Ordinary process Native AC control
Open NUL success access denied
Create anonymous pipe success success
Create global named pipe success WinError 5
Create LOCAL named pipe success success

The global named pipe returns WinError 5, meaning access denied; creation succeeds with the \\.\pipe\LOCAL\ prefix. The difference lies in the Windows object namespace. An application requesting PIPE does not necessarily get an anonymous pipe: CPython 3.12.10's Windows asyncio implementation generates global python-pipe names. Microsoft's named-pipe documentation describes the LOCAL naming requirement for UWP AppContainer processes on Windows 10 version 1709 and later. Our Win32 probes also observe a namespace difference. Granting read access to the script does not change how the runtime creates its pipes, which explains why opening files does not guarantee working communication.

3.3 Node starts Node: execution stalls before spawn returns

The Node case also starts another interpreter, prints a line and sends the child's output back to the parent. Markers before and after spawn() distinguish failing to reach the call from the call failing to return:

import { spawn } from 'node:child_process';

console.log('before_spawn');
const child = spawn(process.execPath, ['-e', "console.log('CHILD_OK')"], {
  stdio: ['inherit', 'pipe', 'pipe'],
});
console.log('spawn_returned');
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
child.once('error', error => { console.error(error); process.exitCode = 1; });
child.once('close', code => { process.exitCode = code ?? 1; });

The initial file-entry run fails during drive-metadata lookup. The retained record contains this error:

EPERM: operation not permitted, lstat 'D:\'

The probe has not run at this point, so this is not a pipe or IPC result. To examine the child-process call, we use the node -e evaluation entry to bypass entry-file loading. Keeping the runtime fixed and changing the standard-stream configuration produces the following stage summary:

Configuration Before spawn After spawn returns Result
Inherited stdio before_spawn spawn_returned pass
Piped stdio before_spawn no spawn_returned terminated by external watchdog after timeout
IPC channel before_spawn no spawn_returned terminated by external watchdog after timeout

Inherited stdio completes, showing that this AC environment can create a child. Blocking appears when pipe or IPC is added, narrowing the problem to communication-channel setup. libuv 1.52.1's Windows pipe implementation uses global pipe names and retries ERROR_ACCESS_DENIED as a possible name collision. This is consistent with the pipe access denial and spawn() not returning, providing a source-supported explanation.

3.4 asyncio starts Python: initialization stalls before the coroutine begins

Finally, we test asynchronous child execution. The code uses asyncio.create_subprocess_exec() to start Python and collect output, with wait_for() limiting the wait. Compared with synchronous Popen, this also depends on an event loop and asynchronous communication facilities:

import asyncio
import subprocess
import sys

async def main():
    p = await asyncio.create_subprocess_exec(
        sys.executable, "-c", "print('CHILD_OK')",
        stdin=subprocess.DEVNULL,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )
    stdout, stderr = await asyncio.wait_for(p.communicate(), timeout=8)
    assert p.returncode == 0 and b"CHILD_OK" in stdout

asyncio.run(main())

The ordinary-process case passes; both direct and Shell execution time out in native AC. To locate the blocked stage, we separately test an empty event loop, socket.socketpair() and an asynchronous pipe. The retained diagnostic results are:

Diagnostic Ordinary process Native AC control
Empty event loop pass timeout before entering coroutine
socket.socketpair() pass timeout
asyncio.windows_utils.pipe() pass WinError 5

Faulthandler diagnostics locate the event-loop block at accept() inside _fallback_socketpair(). The sequence below summarizes the call chain; it is not a complete original stack trace:

Proactor event-loop initialization
  โ†’ _make_self_pipe()
  โ†’ socket.socketpair()
  โ†’ _fallback_socketpair()
  โ†’ accept(): blocked

The default Windows Proactor loop needs socket.socketpair() for its wakeup channel. The tested Python implements it through a local TCP pair. This step did not complete in the native AC control, so the coroutine's child-process code never had a chance to execute. The eight-second timeout around communicate() cannot cover earlier event-loop initialization. Separately, the direct asynchronous-pipe diagnostic encountered WinError 5. These results point to local communication and named pipes respectively; not every asyncio timeout can be attributed to the child-process API itself. Event-loop implementation ยท socketpair implementation

3.5 These tests come from everyday execution paths in open-source Agents

These tests were extracted from actual execution code in well-known open-source Agents: AgentScope, Hermes, DSH and OpenCode. Running commands, starting local MCP services and maintaining background processes are everyday functions. Child creation, standard streams and IPC underpin them:

Open-source project Actual use Required mechanisms Source references
AgentScope Execute local commands and connect to local MCP services asyncio children, standard input/output, event loop Command backend, MCP client
Hermes Start a long-lived process and keep exchanging data Popen, bidirectional stdio, EOF and exit handling Long-lived process
DSH Start the execution Host and run tools through PowerShell Child creation, standard streams, IPC Host lifecycle, PowerShell executor
OpenCode Start local MCP services and exchange protocol messages Child creation, standard input/output MCP transport

We followed these execution paths to extract the minimal tests above, then separately diagnosed the runtime's NUL access, named pipes and local communication. Whether these basic calls work directly affects an Agent's ability to execute commands, collect tool results and connect to local services. Starting Python or Node.js inside AC only begins the execution chain; communication and exit must also work for everyday tasks to continue. Next, we compare Microsoft's MXC to see whether it has resolved these compatibility problems.

4 Can Microsoft's MXC run these basic calls?

Native AC exposes the problems. Has Microsoft's own isolated-execution solution already handled them? We execute the basic calls from chapter three through Microsoft eXecution Container (MXC), keeping each case's runtime and probe code unchanged, and check child startup, communication and exit.

4.1 Results at a glance: 12 pass, 17 do not

Of the 29 mechanism cases, MXC passes 12 and does not pass 17. The four synchronous Popen stdio configurations, bidirectional stdio, repeated and large output, nested PowerShell, expected errors, timeout and cancellation complete. Multiprocessing, nested cmd execution and Python calling Node do not pass. All 12 Node file-entry cases fail during drive lookup, and both asyncio cases time out.

Further diagnostics show that pipe and IPC still block after bypassing the Node file entry. Global named pipes return access denied, and the default asynchronous event loop does not finish initialization. We focus below on these unsuccessful paths: what was tested, which errors occurred and where execution stopped.

4.2 Python: multiprocessing and nested calls still fail

The multiprocessing case starts a worker using spawn, sends ping over a Pipe(), requires the worker to return the same message and confirms normal exit. This tests a common Python worker-communication flow. The collector command below selects that case; its launcher configuration points to the prepared MXC SDK and lab directory:

python examples/appcontainer-child-processes/run.py `
  --backend mxc `
  --launcher C:/lab/mxc-launcher.json `
  --case python.multiprocessing

The case does not pass. The error in the retained record is:

WinError 5

This means access denied, and the worker-creation and communication flow did not complete. Python starting a tool through cmd and Python calling Node also failed. A successful synchronous Popen establishes that particular path; multiprocessing additionally needs worker communication, while nested execution crosses another Shell or runtime. Compatibility gaps remain in those paths.

4.3 Named pipes: NUL opens, but global pipes are still denied

We repeat chapter three's direct pipe diagnostic: open NUL, create an anonymous pipe, then create global and LOCAL named pipes with the same parameters. This separates launch-time object access from pipe-namespace restrictions:

Operation Native AC control MXC 1.0.1
Open NUL access denied success
Create anonymous pipe success success
Create global named pipe WinError 5 WinError 5
Create LOCAL named pipe success success

Global named pipes still return WinError 5 under MXC, while LOCAL pipes succeed. This configuration has not removed the access difference between the namespaces, leaving an obstacle for runtime communication that depends on global named pipes. It also explains why passing synchronous Popen does not establish working Node pipe/IPC or Python asynchronous pipes.

4.4 Node starts Node: entry lookup fails, and communication still blocks after bypassing it

The Node test keeps chapter three's spawn() call. We first run through the script-file entry, then use node -e to isolate communication. The file entry still fails during loading, with the same recorded error as native AC:

EPERM: operation not permitted, lstat 'D:\'

To separate entry loading from channel setup, we compare inherited stdio, pipe and IPC again. The evaluated-entry stage summary is:

Configuration Before spawn After spawn returns MXC 1.0.1 result
Inherited stdio before_spawn spawn_returned pass
Piped stdio before_spawn no spawn_returned timeout
IPC channel before_spawn no spawn_returned timeout

Pipe and IPC calls still do not complete after bypassing entry-file loading. Inherited stdio passes, showing that the interpreter and child-startup path can work. Adding a communication channel leaves spawn() unable to return. Together with global-pipe access denial and the libuv creation/retry behavior discussed in chapter three, these results show that MXC has not completed those communication paths for the tested Node runtime.

4.5 asyncio starts Python: event-loop initialization still does not complete

The asynchronous Python cases retain their asyncio.create_subprocess_exec() and communicate() calls. Direct and Shell execution both time out. We use the empty event loop, socketpair and asynchronous pipe again to distinguish failure stages:

Diagnostic MXC 1.0.1 result Recorded stage or error
Empty event loop timeout coroutine not entered
socket.socketpair() timeout blocked at accept() in _fallback_socketpair()
asyncio.windows_utils.pipe() fail WinError 5

This matches the key native AC observations: local communication required by the event loop does not complete, leaving the coroutine's child-process code unable to run; the direct asynchronous-pipe diagnostic separately encounters access denial. The main experiment allows outbound traffic and denies inbound traffic. To investigate loopback communication further, we explicitly request inbound and host-loopback access through MXC. Before starting the program, the SDK returns:

network.ingress.hostLoopback='allow' is not supported by this version of Windows; host-loopback ingress requires native ProcessContainer support

The error says the requested loopback configuration is unavailable for this operating-system/backend combination. AgentScope's command and local MCP entries, which depend on asyncio, also time out before their tool methods begin. Hermes's long-lived Python stdio case passes. Their initialization and communication paths differ, and so do their results.

In this AC comparison, MXC does not pass 17 of the 29 mechanism cases. Failures involve Python multiprocessing and nested calls, Node entry loading and pipe/IPC communication, and Python's default asynchronous event loop. These mechanisms support Agent command execution and local-tool connections; a blocked required path can prevent a task from continuing. Next, we examine FinShield's compatibility results using the same cases.

5 How does FinShield complete these execution paths?

We next run the same tests inside FinShield. The final campaign uses public version 0.11.72, with Python, Node.js and the Agents retaining their original execution code. All 29 mechanism cases and all six real Agent execution entries pass. The previously unsuccessful multiprocessing, nested execution, Node file-entry, pipe/IPC and asyncio cases complete their expected flows. We follow the preceding chapters' problems to examine those results.

5.1 Python: from Popen to multiprocessing and nested calls

First, repeat the simplest Popen call. It still uses DEVNULL for input and two PIPE values to capture stdout/stderr, then waits for the child to exit:

import subprocess
import sys

p = subprocess.Popen(
    [sys.executable, "-c", "import sys; print('AC_PROBE_OK'); print('AC_PROBE_STDERR', file=sys.stderr)"],
    stdin=subprocess.DEVNULL,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    text=True,
)
stdout, stderr = p.communicate(timeout=8)
assert p.returncode == 0
assert "AC_PROBE_OK" in stdout and "AC_PROBE_STDERR" in stderr

The Popen probe returns the expected output under FinShield, with exit code 0. With identity events omitted, the result organized by output stream is:

stdout: AC_PROBE_OK
stderr: AC_PROBE_STDERR
returncode: 0

The rerun also covers the previously unsuccessful workers and nested execution. Multiprocessing completes the ping exchange and exits normally. Python starting tools through cmd and PowerShell, and Python calling Node, also produce the expected results:

Case Native AC control MXC 1.0.1 FinShield 0.11.72
Popen, separate output capture fail pass pass
Multiprocessing worker communication fail WinError 5 pass
Python โ†’ cmd โ†’ tool fail fail pass
Python โ†’ PowerShell โ†’ tool fail pass pass
Python โ†’ Node fail fail pass

5.2 Pipes: the original global names can be created

We then run chapter three's direct pipe diagnostic, retaining the program's CreateNamedPipe() calls with global and LOCAL names. NUL and anonymous pipes are checked as well:

Operation Native AC control MXC 1.0.1 FinShield 0.11.72
Open NUL access denied success success
Create anonymous pipe success success success
Create global named pipe WinError 5 WinError 5 success
Create LOCAL named pipe success success success

The global named pipe no longer returns access denied. The application keeps its original call and name, and the communication object is created successfully. An independent diagnostic also confirms that asyncio.windows_utils.pipe() completes, providing a working pipe path for subsequent asynchronous children. These direct diagnostics are recorded separately and do not add to the 29 mechanism cases.

5.3 Node: file entry, pipe and IPC all complete

The Node rerun starts through the normal file entry, without substituting evaluation for the mechanism cases. All 12 cases previously stopped by drive-metadata lookup pass, covering spawn, exec, execFile, fork, bidirectional communication, repeated and large output, Python calls and expected error handling. The core probe calls are below; collect() captures output, handles exit and checks timeouts:

const result = await collect(
  spawn(process.execPath, leafArgs(), {
    stdio: ['ignore', 'pipe', 'pipe'],
  }),
);
check(result.stdout.includes('AC_PROBE_OK'), 'Missing output');

const ipcResult = await collect(
  fork(file, ['--child', 'ipc'], { silent: true }),
  { ipc: true },
);
check(ipcResult.message?.reply === 'ping', 'Missing IPC reply');

The pipe case requires output, while the IPC case requires a reply to ping; both must also confirm normal child exit. The final report contains the following result events, with the fixed probe identifier omitted:

{"event":"result","case":"spawn-pipe","status":"pass","details":{"stdio":"pipe","output_asserted":true}}
{"event":"result","case":"fork-ipc","status":"pass","details":{}}

Separately collected evaluation-entry diagnostics also pass for pipe and IPC. Where spawn() previously did not return, communication, result validation and exit now complete:

Execution path Native AC control MXC 1.0.1 FinShield 0.11.72
Node file-entry mechanism cases drive-lookup failure drive-lookup failure 12 pass
Evaluated entry, pipe communication timeout timeout pass
Evaluated entry, IPC round trip timeout timeout pass

5.4 asyncio: enter the coroutine, collect output and exit normally

The asynchronous rerun retains the default event loop and original child-process API. Its core call is:

import asyncio
import subprocess

async def main():
    p = await asyncio.create_subprocess_exec(
        python_exe, probe_file, "--child", "echo",
        stdin=subprocess.DEVNULL,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )
    stdout, stderr = await asyncio.wait_for(p.communicate(), timeout=8)
    assert p.returncode == 0
    assert b"AC_PROBE_OK" in stdout
    assert b"AC_PROBE_STDERR" in stderr

asyncio.run(main())

This time, execution enters the coroutine, starts the child, collects stdout/stderr and exits with code 0. The final report's results, organized by output stream, are:

stdout: AC_PROBE_OK
stderr: AC_PROBE_STDERR
returncode: 0
case: asyncio-exec
status: pass

Asynchronous Shell execution also passes. Both mechanism cases that previously stalled during event-loop initialization now complete child execution and output validation. The rerun uses default execution code, without an IPv6 substitution to obtain passes.

Case Native AC control MXC 1.0.1 FinShield 0.11.72
asyncio direct execution timeout timeout pass
asyncio Shell execution timeout timeout pass

5.5 Real Agent entries: released code completes its execution flows

After the basic calls, we examine the execution entries actually used by Agents. For example, the AgentScope test still calls the released LocalBackend.exec_shell, which performs asyncio child creation and output capture:

backend = LocalBackend(workdir=workspace)
result = await backend.exec_shell(
    [python_exe, probe_file, "--child", "echo"],
    cwd=workspace,
    timeout=8,
)
assert result.exit_code == 0
assert b"AC_PROBE_OK" in result.stdout

The call returns the expected output with exit code 0. Results for all six real execution entries are:

Real execution entry MXC 1.0.1 FinShield 0.11.72
AgentScope command timeout before method pass
AgentScope local MCP timeout before method pass
Hermes long-lived process pass pass
DSH Desktop Host drive-metadata failure pass
DSH PowerShell drive-metadata failure pass
OpenCode local MCP drive-metadata failure pass

These six entries cover command execution, local MCP connections, long-lived process communication, and Host startup/shutdown. In the rerun they complete their respective output-capture, protocol-initialization, request/response and shutdown flows, without the earlier initialization timeouts or entry-loading failures. Identity observations across the 29 mechanism cases and six execution entries also match AC expectations. The original execution code completes its expected flows, and the observed processes retain their AC identity.

6 Comparison: from starting interpreters to completing execution chains

Combining the basic calls and real Agent entries gives the following results. Ordinary processes provide a baseline confirming that the tests complete without AC restrictions:

Cases completing their expected flow Ordinary Native AC control MXC 1.0.1 FinShield 0.11.72
Python/Node.js mechanisms 29/29 0/29 12/29 29/29
Real Agent execution entries 6/6 0/6 1/6 6/6

The native AC control encounters blockers during device access, entry loading and initialization. MXC completes some synchronous calls, but leaves unsuccessful paths in multiprocessing, nested execution, Node communication and the default asynchronous event loop. FinShield completes all 29 mechanism cases and six real execution entries, with identity observations in all 35 matching AC expectations. The completed flows extend from starting programs through communication, result collection and exit.

For every case result, environment details, source references and collection scope, see the AppContainer child-process experiment record. Scripts are in the public experiment directory.

In this comparison, FinShield carries the existing execution code through its expected flows while the observed processes retain their AC identity. Retaining that identity means tools remain subject to permission checks when accessing files, devices and other programs as they perform tasks. Safety evaluations cover camera and microphone capture, screenshots and screen recording, desktop interference, process operations, system-setting changes, and reading, modifying or deleting protected data, demonstrating FinShield's protective effects in these scenarios. Safety evaluation results

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.