mirror of
https://github.com/morluto/rea
synced 2026-10-27 22:45:19 -04:00
cbc0dd1e7c
* fix(contracts)!: require absolute local paths for remaining caller-supplied file inputs Follow-up to the session snapshot/export tightening: the same invisible server-cwd resolution applied to open_binary target paths (parseBinaryTarget(path, process.cwd())), import_evidence_bundle bundle reads, firmware input files (resolve(raw)), browser executable launch paths (resolve-then-spawn), Electron executable/application/root paths (realpath on raw input), and the expected server path check. Each field gains the shared isAbsoluteLocalPath refinement plus a catalog-visible description, since JSON Schema cannot express the rule. Examples, scenario fixtures, and contract tests updated to absolute paths; new schema cases cover rejection/acceptance/omission per field. Explicitly unchanged (verified rooted or out of scope): inspect_plist paths (resolved against the target bundle dir), firmware output_directory (already provider-enforced), filesystem observation paths (resolved against the caller-supplied working_directory), keyed-archive member paths (archive-relative), JS evidence member paths (evidence-relative under root_alias), provider-internal execution schemas, CLI-only doctor flows, and CLI options (own resolve against the operator cwd). * fix(cli): resolve operator-relative paths before shared absolute-path validation The contract tightening rejects relative paths, but three CLI commands forward operator-relative input into the shared schemas: firmware commands pass raw args to FirmwareAnalysisService, and the Electron/browser scenario commands validate parsed scenario JSON directly. CLI paths are relative to the operator shell, so resolve them against the working directory first: resolve() in firmwareCommands, and a shared resolveCliJsonPaths JSON key-path helper (cliJsonInput) applied in electronCommands and cliBrowserScenarioCommands. MCP behavior is unchanged — MCP callers must still send absolute paths. Covers the regression with a relative-path firmware CLI acceptance test (asserts provider-stage capability_unavailable, not a validation error) and unit tests for the helper.
80 lines
3.1 KiB
TypeScript
80 lines
3.1 KiB
TypeScript
import type { JsonValue } from "../domain/jsonValue.js";
|
|
import { UNKNOWN_CONTRACT_EXAMPLES } from "./unknownContractExamples.js";
|
|
import { ARTIFACT_COMPARISON_EXAMPLE } from "./artifactComparisonExample.js";
|
|
import { FUNCTION_COMPARISON_EXAMPLE } from "./functionComparisonExample.js";
|
|
import {
|
|
INVESTIGATION_EXAMPLES,
|
|
PROCESS_CAPTURE_REFERENCE,
|
|
PROCESS_CAPTURE_RECONSTRUCTION,
|
|
} from "./investigationExamples.js";
|
|
|
|
/** Canonical examples for contracts whose required inputs have no defaults. */
|
|
export const TOOL_EXAMPLE_OVERRIDES: Readonly<
|
|
Record<string, Readonly<Record<string, JsonValue>>>
|
|
> = {
|
|
...UNKNOWN_CONTRACT_EXAMPLES,
|
|
...INVESTIGATION_EXAMPLES,
|
|
goto_address: { address: "0x1000" },
|
|
procedure_address: { procedure: "main" },
|
|
procedure_assembly: { procedure: "main" },
|
|
procedure_callees: { procedure: "main" },
|
|
procedure_callers: { procedure: "main" },
|
|
procedure_info: { procedure: "main" },
|
|
trace_native_values: { procedure: "0x1000" },
|
|
inspect_native_data_type: { type: "/MyStruct" },
|
|
inspect_native_instruction: { address: "0x1000" },
|
|
resolve_native_call_targets: { address: "0x1000" },
|
|
read_function_instructions: { procedure: "main" },
|
|
read_bytes: { address: "0x1000", length: 16 },
|
|
address_to_file_offset: { address: "0x1000" },
|
|
procedure_references: { procedure: "main" },
|
|
procedure_pseudo_code: { procedure: "main" },
|
|
resolve_containing_procedure: { address: "0x1000" },
|
|
search_procedures: { pattern: "main" },
|
|
search_strings: { pattern: "authorization failed" },
|
|
set_address_name: { address: "0x1000", name: "entry" },
|
|
set_addresses_names: { names: { "0x1000": "entry" } },
|
|
set_bookmark: { address: "0x1000" },
|
|
set_comment: { address: "0x1000", comment: "validated entry point" },
|
|
set_current_document: { document: "fixture" },
|
|
set_inline_comment: { address: "0x1000", comment: "calls parser" },
|
|
unset_bookmark: { address: "0x1000" },
|
|
get_call_graph: { address: "0x1000" },
|
|
find_xrefs_to_name: { name: "malloc" },
|
|
analyze_function: { procedure: "main" },
|
|
annotate_native_function: {
|
|
procedure: "0x10100",
|
|
name: "entry",
|
|
comment: "Analyst observation",
|
|
},
|
|
analyze_swift_types: { category: "classes", pattern: "Account" },
|
|
inspect_native_api: { procedure: "main" },
|
|
trace_feature: { query: "license" },
|
|
trace_call_path: { start: "0x1000", goal: "0x1100" },
|
|
trace_native_ui_action: { action: "buildTapped:" },
|
|
open_binary: { path: "/tmp/fixture" },
|
|
export_evidence_bundle: { path: "/tmp/evidence.json" },
|
|
inspect_address_context: { address: "0x1000" },
|
|
import_evidence_bundle: { path: "/tmp/evidence.json" },
|
|
capture_process_scenario: {
|
|
executable: "/usr/bin/true",
|
|
working_directory: "/tmp",
|
|
},
|
|
compare_process_captures: {
|
|
left: PROCESS_CAPTURE_REFERENCE,
|
|
right: PROCESS_CAPTURE_RECONSTRUCTION,
|
|
},
|
|
compare_artifacts: {
|
|
left: ARTIFACT_COMPARISON_EXAMPLE.left,
|
|
right: ARTIFACT_COMPARISON_EXAMPLE.right,
|
|
},
|
|
compare_functions: {
|
|
left: FUNCTION_COMPARISON_EXAMPLE.left,
|
|
right: FUNCTION_COMPARISON_EXAMPLE.right,
|
|
},
|
|
compare_bundles: {
|
|
left_bundle_path: "/tmp/left-evidence.json",
|
|
right_bundle_path: "/tmp/right-evidence.json",
|
|
},
|
|
};
|