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(cli): reject an empty JavaScript application path (#5265)
Vishal Tambi1a945ce9ff77
diff --git a/src/cli/electronCommands.ts b/src/cli/electronCommands.tsindex 4dda8d7de..12ef5591e 100644--- a/src/cli/electronCommands.ts+++ b/src/cli/electronCommands.ts@@ -297,7 +297,9 @@ const registerJavaScriptApplicationCommand = (logCliCommand(logger, CLI_COMMANDS.analyzeJavaScriptApplication, () =>runCliJavaScriptApplicationAnalysis({- input_path: absoluteCallerPath(args.path),+ // An empty path names no file; leave it for input validation.+ input_path:+ args.path === "" ? args.path : absoluteCallerPath(args.path),format: options.artifactFormat,integrity_policy: options.integrityPolicy,...(options.maxSemanticNodes === undefineddiff --git a/tests/boundary/javascript/javascriptSelectedPathEvidence.test.ts b/tests/boundary/javascript/javascriptSelectedPathEvidence.test.tsindex d5372238e..7a23bee1f 100644--- a/tests/boundary/javascript/javascriptSelectedPathEvidence.test.ts+++ b/tests/boundary/javascript/javascriptSelectedPathEvidence.test.ts@@ -140,3 +140,28 @@ cliTest().toBe(true);},);++// Anchoring must not turn an empty selection into the working directory.+cliTest.for([+ {+ command: "analyze-javascript-application",+ rejection: {+ code: "invalid_request",+ details: { issues: [expect.objectContaining({ path: ["input_path"] })] },+ },+ },+ { command: "analyze", rejection: { code: "VALIDATION_ERROR" } },+])(+ "$command rejects an empty path instead of analyzing the working directory",+ async ({ command, rejection }, { cli }) => {+ const root = await createTestTempDirectory("rea-js-empty-path-");+ await writeFile(join(root, "main.js"), "export const value = 7;\n");+ const response = await cli.run({+ arguments: [command, "", "--json"],+ cwd: root,+ environment: { REA_LOG_LEVEL: "silent" },+ });+ expect(response.exitCode, response.stderr).toBe(1);+ expect(response.json).toMatchObject(rejection);+ },+);