Files
reverse-engineering-anything/src/ghidra/GhidraRuntimeFile.ts
T
Matt Van Horn 3d472bde23 fix(ghidra): reject JDK_JAVA_OPTIONS argument-file platform overrides
Fixes #6212. Parse effective argfile syntax once, admit bounded regular files with retained cleanup/cancellation ownership, freeze validated bytes for subsequent helpers and analysis launch, and share existing private-runtime writing. Resolves the continuation, FIFO and mutable-source review findings.

Verified 97 related tests (3 explicit skips), full static/docs checks, two independent local Codex reviews and 12 real installed-JDK17 grammar/property controls. Real Ghidra, JDK25 and native Windows qualification remain unavailable. Used the explicitly authorized maintainer bypass: current GitHub CI remained queued and Greptile rerun was still in progress; author-readiness metadata was not fabricated.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
2026-10-22 23:00:50 +08:00

17 lines
613 B
TypeScript

import { basename, dirname } from "node:path";
import writeFileAtomic from "write-file-atomic";
import { windowsPrivateRuntime } from "../windows/WindowsPrivateRuntime.js";
/** Runtime-owned configuration text: private native handle on Windows, private atomic write on POSIX. */
export const writeGhidraRuntimeFile = async (
path: string,
content: string,
platform: NodeJS.Platform,
): Promise<void> => {
if (platform === "win32") {
windowsPrivateRuntime(dirname(path)).writeFile(basename(path), content);
return;
}
await writeFileAtomic(path, content, { encoding: "utf8", mode: 0o600 });
};