mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 09:52:27 +00:00
* fix(verifiers): retain native cleanup ownership on failure * fix(verification): load cleanup fixtures through the module resolver CodeQL's local threat model treats file contents passed to vm.SourceTextModule as user-controlled code execution. Import the real verifier modules and redirect their dependencies to static mocks instead of compiling script text read from disk. * fix(verifiers): own CLI and MCP process families * fix(verifiers): retire workspaces after cleanup retry --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
103 lines
2.7 KiB
JavaScript
103 lines
2.7 KiB
JavaScript
import { promisify } from "node:util";
|
|
|
|
const dossier = {
|
|
pseudocode: "int main(){}",
|
|
assembly: ["ret"],
|
|
procedure: { body: { available: false } },
|
|
};
|
|
|
|
/** Shared stand-in state for the IDA verifier cleanup driver. */
|
|
export const idaCleanupState = {
|
|
failClose: false,
|
|
events: [],
|
|
target: "",
|
|
report: "",
|
|
primary: new Error("inert analyze failure"),
|
|
cleanup: new Error("inert close_binary failure"),
|
|
};
|
|
|
|
const evidence = {
|
|
provider: { id: "ida", version: "1" },
|
|
analysis_profile: {
|
|
parameters: { cache_policy: "live", engine_version: null },
|
|
},
|
|
limitations: ["inert"],
|
|
locations: [{ kind: "artifact-path" }],
|
|
operation: "analyze_function",
|
|
relationship_coverage: { status: "unknown" },
|
|
normalized_result: dossier,
|
|
};
|
|
|
|
export { promisify };
|
|
export function parseArgs() {
|
|
return {
|
|
values: {
|
|
target: idaCleanupState.target,
|
|
report: idaCleanupState.report,
|
|
procedure: "main",
|
|
"second-procedure": "helper",
|
|
"second-marker": "marker",
|
|
},
|
|
};
|
|
}
|
|
|
|
export const execFile = Object.assign(
|
|
() => {
|
|
throw new Error("Spawning forbidden");
|
|
},
|
|
{
|
|
[promisify.custom]: async () => ({ stdout: JSON.stringify(evidence) }),
|
|
},
|
|
);
|
|
|
|
export class Client {
|
|
async connect() {
|
|
idaCleanupState.events.push("connect");
|
|
}
|
|
async callTool({ name }) {
|
|
idaCleanupState.events.push(name);
|
|
if (name === "analyze_function") throw idaCleanupState.primary;
|
|
if (name === "close_binary" && idaCleanupState.failClose)
|
|
throw idaCleanupState.cleanup;
|
|
return { structuredContent: {} };
|
|
}
|
|
async close() {
|
|
idaCleanupState.events.push("client.close");
|
|
}
|
|
}
|
|
|
|
export class StdioClientTransport {
|
|
async close() {
|
|
idaCleanupState.events.push("transport.close");
|
|
}
|
|
}
|
|
|
|
export function assertFeatureTrace() {}
|
|
export function findMappedNonFunction() {}
|
|
export function requireMcpToolError() {}
|
|
export const withVerifierResourceOwner = (operation) => operation({});
|
|
export const toolContract = () => ({
|
|
outputSchema: { parse: (value) => value },
|
|
});
|
|
export const evidenceSchema = { parse: (value) => value };
|
|
export const functionDossierSchema = { parse: (value) => value };
|
|
export const readIdaConfiguration = async () => ({
|
|
ok: true,
|
|
value: { mode: "attached", protocol: "native", timeoutMs: 100 },
|
|
});
|
|
export const idaCompatibilityProfile = () => ({ protocol: "native" });
|
|
export function createIdaMcpConnection() {
|
|
throw new Error("upstream never reached");
|
|
}
|
|
export const idaAddressSchema = { parse: (value) => value };
|
|
|
|
export async function createOwnedMcpStdioTransport() {
|
|
return new StdioClientTransport();
|
|
}
|
|
export async function createVerifierCommands() {
|
|
return {
|
|
exec: (...args) => promisify(execFile)(...args),
|
|
close: async () => {},
|
|
};
|
|
}
|