Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(process): return private runtime ownership at allocation
morlutoc22111eca2c4
diff --git a/docs/ida-provider.md b/docs/ida-provider.mdindex d2e939561..9b1539933 100644--- a/docs/ida-provider.md+++ b/docs/ida-provider.md@@ -58,7 +58,7 @@ rea function 'D:\samples\program.exe' main --jsonHeadless REA and the configured supervisor must share the host filesystem and native path syntax. Run REA on Windows when the supervisor runs on Windows. The attached profile can span WSL and a Windows GUI because it binds recorded input hashes instead of asking the GUI to open a WSL path.-REA copies the admitted binary into a private temporary directory, checks its digest, and requests an owned worker with `force_headless`. POSIX workspaces use mode `0700`; Windows uses the matching package's native private-DACL boundary on a local NTFS temporary directory. It injects the returned database ID into analysis requests. It verifies the active owned worker and input path rather than adopting a user database. On close or failed startup, it releases its session with `save: false`, verifies that it is absent from upstream session discovery, and removes its private input and sidecars. An unverified release retains the workspace and reports incomplete cleanup.+REA copies the admitted binary into a private temporary directory, checks its digest, and requests an owned worker with `force_headless`. POSIX workspaces are created atomically with owner-only permissions, respecting the process umask; Windows uses the matching package's native private-DACL boundary on a local NTFS temporary directory. It injects the returned database ID into analysis requests. It verifies the active owned worker and input path rather than adopting a user database. On close or failed startup, it releases its session with `save: false`, verifies that it is absent from upstream session discovery, and removes its private input and sidecars. An unverified release retains the workspace and reports incomplete cleanup.One REA session owns one database. Stdio registrations default `IDA_MCP_MAX_WORKERS` to `1`; the explicit upstream `--max-workers 1` also bounds a supervisor. Database size and engine memory depend on the target and upstream; REA does not impose an engine memory limit. The original binary is never executed or overwritten. Optional `workspaceRoot` selects an existing absolute temporary-directory parent on the REA host. Ensure it has space for the input copy and IDA working files.diff --git a/docs/installation.md b/docs/installation.mdindex ff6210f8f..1df0a7479 100644--- a/docs/installation.md+++ b/docs/installation.md@@ -785,7 +785,7 @@ Ghidra's default analysis settings, and loads its packaged Javabridge via `-scriptPath`; it never opens an existing user project. Linux andmacOS use a current-user-only local bridge socket and descriptor. Theproject remains under the selected temporary directory. If its Unix socket-pathname would exceed the host's byte limit, REA allocates a separate mode-0700+pathname would exceed the host's byte limit, REA allocates a separate owner-onlysocket directory under `/tmp` and removes it on close, cancellation, or failure.Diagnostics retain the actual endpoint and both owned directories.On Linux and macOS, REA starts the inspected JVM directly using Ghidra's own LaunchSupportdiff --git a/src/process/PrivateRuntimeRoot.ts b/src/process/PrivateRuntimeRoot.tsindex 8fe63ce72..7002e2f65 100644--- a/src/process/PrivateRuntimeRoot.ts+++ b/src/process/PrivateRuntimeRoot.ts@@ -1,4 +1,4 @@-import { chmod, mkdtemp, rm } from "node:fs/promises";+import { mkdtemp, rm } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";@@ -23,7 +23,7 @@ export type PrivateRuntimeRootCapability =| {readonly available: true;readonly reason: null;- readonly proof: "posix-mode-0700";+ readonly proof: "posix-mkdtemp-owner-only";};/** Report whether this process can establish a private runtime root. */@@ -32,7 +32,7 @@ export const privateRuntimeRootCapability = (): PrivateRuntimeRootCapability =>platform === "win32"? windowsNativeCapabilities(platform).private_runtime_dacl- : { available: true, reason: null, proof: "posix-mode-0700" };+ : { available: true, reason: null, proof: "posix-mkdtemp-owner-only" };/** Expected failure when a runtime root's privacy boundary is unavailable. */export class PrivateRuntimeRootUnavailableError extends Error {@@ -77,13 +77,9 @@ export class PrivateRuntimeRoot {const path = await mkdtemp(join(options.parent ?? tmpdir(), options.prefix ?? "rea-provider-"),);- try {- await chmod(path, 0o700);- return new PrivateRuntimeRoot(path);- } catch (cause: unknown) {- await rm(path, { recursive: true, force: true });- throw cause;- }+ // POSIX mkdtemp establishes owner-only access atomically. Return its owner+ // without a fallible permission rewrite and rollback after allocation.+ return new PrivateRuntimeRoot(path);}/**diff --git a/tests/boundary/process/providerProcess.test.ts b/tests/boundary/process/providerProcess.test.tsindex 068f6becb..0f0d4e7ca 100644--- a/tests/boundary/process/providerProcess.test.ts+++ b/tests/boundary/process/providerProcess.test.ts@@ -1,6 +1,7 @@-import { access, stat } from "node:fs/promises";+import { access, stat, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { fileURLToPath } from "node:url";+import { join } from "node:path";import { afterEach, describe, expect, it, vi } from "vitest";@@ -57,7 +58,8 @@ describe("provider process runtime and wait primitives", () => {parent: tmpdir(),prefix: "rea-provider-test-",});- expect((await stat(runtime.path)).mode & 0o777).toBe(0o700);+ expect((await stat(runtime.path)).mode & 0o077).toBe(0);+ await writeFile(join(runtime.path, "owned-scratch"), "fixture");const first = runtime.close();const second = runtime.close();