refactor(files): use caller paths for local evidence files

This commit is contained in:
morluto
2026-09-29 14:53:20 +08:00
parent 3f547eafa4
commit c34efca4cd
51 changed files with 289 additions and 936 deletions
@@ -168,9 +168,10 @@ requires an active permission grant and literal per-call approval bound to the
exact replay plan. Project, session, and administrator grants may satisfy the
permission-policy layer, but none replace that per-run approval.
Reproducer export is a separate host write after the sandbox has stopped. It
uses the existing bounded `evidence_write` authority and a separate export
approval; `javascript_replay` alone never writes a host file.
Reproducer export is a separate host write after the sandbox has stopped. This
ADR's root-scoped `evidence_write` authority was removed; current exports use
the path supplied by the caller, while replay still waits for complete sandbox
cleanup before writing.
### 2. Admit extracted modules only
+2 -2
View File
@@ -79,8 +79,8 @@ Each left/right run is retained as its own `observed` source Evidence. A
differential envelope is `derived` and links those source Evidence IDs, so the
comparison never erases the underlying observations.
Optional `reproducer_export` is committed by the plan and requires separate
`evidence_write` authority.
Optional `reproducer_export` is committed by the plan and writes to its
caller-supplied path after the sandbox has stopped.
The owner-only manifest is written only after complete sandbox cleanup. Source
bytes are excluded unless `include_sources: true` was explicitly approved.
An export failure is retained in the result and does not erase a completed
+5 -5
View File
@@ -178,8 +178,8 @@ promote static inference into passive runtime observation or prove that the
original application, renderer, preload, main process, or remote service
behaved identically.
Module and explicit case lists have no fixed item-count ceiling. Planning checks
the complete request against the committed worker-protocol byte limit before
probing executables or reading modules; aggregate module-source and case-input
bytes have their own limits. Preset-generated cases remain capped at 64 because
REA expands that scalar request into case records before sandbox startup.
Module, explicit case, and preset-generated case lists have no fixed
item-count ceiling. Replay plans commit the caller's resource budgets, and the
worker protocol checks the complete request against that declared byte budget
before probing executables or reading modules. Aggregate module-source and
case-input bytes are likewise checked against the caller's declared budgets.
+7 -7
View File
@@ -1,11 +1,11 @@
# JavaScript artifact reconstruction
REA can project an operator-supplied Electron/JavaScript application directory
or ASAR into [JavaScript Application Graph v1](javascript-application-graph.md)
or ASAR into [JavaScript Application Graph](javascript-application-graph.md)
without executing application code. The target-free
`analyze_javascript_application` MCP tool, dedicated
`rea analyze-javascript-application` CLI command, and generic
`rea analyze PATH --approved` directory/ASAR route expose the same application
`rea analyze PATH` directory/ASAR route expose the same application
service and return an Evidence envelope containing the graph and an Electron
boundary summary.
@@ -26,10 +26,10 @@ rea analyze-javascript-application /absolute/path/to/apps/app.asar \
```
Generic `rea analyze` selects this static provider for directories and `.asar`
paths when neither `--provider` nor `--snapshot` is supplied. Use the dedicated
command when setting explicit format or reconstruction limits. Native targets,
single JavaScript files, `.app` bundles, and explicit deep-provider or snapshot
requests retain the native deep-analysis route.
paths when neither `--provider` nor `--snapshot` is supplied. The dedicated
command and the generic route return their complete results inline. Native
targets, single JavaScript files, `.app` bundles, and explicit deep-provider or
snapshot requests retain the native deep-analysis route.
Configure an MCP client with the ordinary REA setup command:
@@ -48,7 +48,7 @@ The equivalent MCP input is:
`input_path` must be absolute. `format` accepts `auto`, `asar`, or `directory`.
The result retains the canonical local path, root artifact digest, artifact
manifest and graph commitments, JavaScript Application Graph v1, static
manifest and graph commitments, JavaScript Application Graph, static
Electron summary, reconstruction statistics, and explicit limitations. It does
not require a live Hopper, Ghidra, browser, or Electron process.
+4 -5
View File
@@ -83,12 +83,11 @@ Existing environment settings map to administrator ceilings. They remain the
maximum authority:
- process roots, executables, environment names, and external networking;
- Evidence read/write roots;
- investigation input and workspace roots;
- snapshot read/write roots;
- reference-source roots;
- native mount enablement.
Evidence bundles and analysis snapshots use the path supplied to the CLI or MCP
tool; they do not require configured roots or separate read/write grants.
Artifact extraction takes no path or occurrence selectors. It materializes all
regular files into a fresh REA-chosen temporary directory. The write still
passes through the active permission evaluator; the tool caller does not choose
@@ -122,7 +121,7 @@ administrator ceiling. A request outside that ceiling reports
`elicitation_supported: false` and `restart_required: true`; interactive consent
cannot silently widen administrator policy.
`analyze_javascript_application` reads the selected local directory or ASAR directly. It has no per-call approval flag or configured investigation root.
`analyze_javascript_application` reads the supplied local directory or ASAR path directly and returns its result and Evidence inline; no approval flag or root configuration is needed.
## Integrity record-and-continue
+2 -2
View File
@@ -501,9 +501,9 @@
"mcp_prompts": 6
},
"digests": {
"tools_sha256": "623e9fd65a117626fe8e3cc4715a8ab8ba694120202ea6413103552b5f5bfefb",
"tools_sha256": "de5819e4e0d2c141e71493fb32efedebf3b600d0bac70a71073cecbe21dd34ed",
"prompts_sha256": "7f7f15d84efdce3487412ea64fdf4b83d3d6cf01b42c7fadc3e046799a2b0b15",
"combined_sha256": "d37c2bd4930e6065896ba8085f03681c2b376d9d236a6798d55b466ba42749d9",
"combined_sha256": "ac4da7d924b2f65ff14108d03f3838cebbbf8c92c9ae3034165375e0b12678fd",
"providers_sha256": "7247eece8fad09c8023af8d5c682d223d7ed7ebd68eac79e9154962a7e03b66b"
}
}
+3 -3
View File
@@ -32,10 +32,10 @@ harm_rank,location,trigger,current_copy,user_risk,proposed_replacement,implement
24.93,src/server/registerFunctionComparisonTool.ts:probe rationale,Function comparison is incomplete,Capture complete dossiers with equal providers and analysis limits.,Exposes provider architecture and gives ambiguous equality guidance,"Capture complete dossiers for both functions under the same target context and analysis limits.",implemented,verified by focused function-comparison MCP test
24.95,incur:CLI argument validation,Caller omits or mistypes a command argument,VALIDATION_ERROR with raw Zod Details and fieldErrors including code/path/expected/received,Exposes validator representation and buries the useful correction,"REA could not read the command arguments. Check the named argument and its expected type, then try again.",implemented,verified by sanitizer unit tests and real dispatcher missing-argument test
25,src/application/ReferenceSourceImport.ts:cancelled,Reference-source import is cancelled,Reference source import cancelled,No recovery timing guidance,"Reference source import was cancelled. Start it again when ready.",implemented,focused assertions passed
26,src/application/ReferenceSourceImportPolicy.ts:invalid-limits,Configured import limits are not positive integers,Import limits must be positive integers,Does not tell user where recovery lies,"Reference source limits are invalid. Use positive integer limits, then try again.",implemented,focused assertions passed
26,src/application/ReferenceSourceImportPolicy.ts:invalid-limits,Configured import limits are not positive integers,Import limits must be positive integers,Fixed importer ceilings prevented full source imports,Removed fixed byte, entry, depth, and path limits.,removed,verified by greater-than-10000 entry and greater-than-16-MiB regressions
27,src/application/ReferenceSourceImportPolicy.ts:invalid-root,Source path cannot resolve or is not a directory,Reference source root could not be resolved / Reference source root is not a directory,Multiple low-level copies and no complete path check,"Reference source directory could not be opened. Check that the path exists, is readable, and points to a directory.",implemented,focused assertions passed
28,src/application/ReferenceSourceImportPolicy.ts:policy,No approved root exists or requested root is outside policy,No approved reference source roots / Reference source root is outside approved roots,Does not identify safe configuration recovery,"Reference source directory is not approved. Add its directory to `REA_REFERENCE_ROOTS_JSON`, restart REA, then try again.",implemented,focused assertions passed
29,src/application/ReferenceSourceImport.ts:io,Reader fails during bounded traversal,Raw reader error message,May expose filesystem details and inconsistent recovery,"Reference source files could not be read. Check directory permissions and try again.",implemented,focused assertions passed
28,src/application/ReferenceSourceImportPolicy.ts:policy,No approved root exists or requested root is outside policy,No approved reference source roots / Reference source root is outside approved roots,Approval friction duplicates direct caller path selection,Removed the configured root allowlist and permission gate; caller-selected directories are validated and traversed directly.,removed,verified by source search and focused import tests
29,src/application/ReferenceSourceImport.ts:io,Reader fails during traversal,Raw reader error message,May expose filesystem details and inconsistent recovery,"Reference source files could not be read. Check directory permissions and try again.",implemented,focused assertions passed
30,src/application/ReferenceSourceImport.ts:parse,Historical graph validation fails,Raw thrown graph validation message,Can expose internal graph invariants,"Reference source could not be indexed. Check that the source tree is readable, then try again.",implemented,focused assertions passed
31,src/application/ReferenceSourceImportTypes.ts:limit,Import reports terminal limit failure,No reachable constructor found,Declared state may be unreachable; false verification risk,Remove unreachable top-level limit variant; per-entry limit guidance remains caller-visible.,removed,"verified by typecheck, exhaustive projection test, and source search"
32,src/application/Setup.ts:configureDetectedClients(backup),Agent configuration backup fails,"{clientName} configuration backup verification failed; no successful configuration was reported.",Exposes machine client key and obscures no-write guarantee,"Agent configuration could not be backed up, so no change was made. Check file permissions, then rerun setup.",implemented,focused assertions passed
1 harm_rank location trigger current_copy user_risk proposed_replacement implementation_status verification_result
32 24.93 src/server/registerFunctionComparisonTool.ts:probe rationale Function comparison is incomplete Capture complete dossiers with equal providers and analysis limits. Exposes provider architecture and gives ambiguous equality guidance Capture complete dossiers for both functions under the same target context and analysis limits. implemented verified by focused function-comparison MCP test
33 24.95 incur:CLI argument validation Caller omits or mistypes a command argument VALIDATION_ERROR with raw Zod Details and fieldErrors including code/path/expected/received Exposes validator representation and buries the useful correction REA could not read the command arguments. Check the named argument and its expected type, then try again. implemented verified by sanitizer unit tests and real dispatcher missing-argument test
34 25 src/application/ReferenceSourceImport.ts:cancelled Reference-source import is cancelled Reference source import cancelled No recovery timing guidance Reference source import was cancelled. Start it again when ready. implemented focused assertions passed
35 26 src/application/ReferenceSourceImportPolicy.ts:invalid-limits Configured import limits are not positive integers Import limits must be positive integers Does not tell user where recovery lies Fixed importer ceilings prevented full source imports Reference source limits are invalid. Use positive integer limits, then try again. Removed fixed byte implemented entry focused assertions passed depth
36 27 src/application/ReferenceSourceImportPolicy.ts:invalid-root Source path cannot resolve or is not a directory Reference source root could not be resolved / Reference source root is not a directory Multiple low-level copies and no complete path check Reference source directory could not be opened. Check that the path exists, is readable, and points to a directory. implemented focused assertions passed
37 28 src/application/ReferenceSourceImportPolicy.ts:policy No approved root exists or requested root is outside policy No approved reference source roots / Reference source root is outside approved roots Does not identify safe configuration recovery Approval friction duplicates direct caller path selection Reference source directory is not approved. Add its directory to `REA_REFERENCE_ROOTS_JSON`, restart REA, then try again. Removed the configured root allowlist and permission gate; caller-selected directories are validated and traversed directly. implemented removed focused assertions passed verified by source search and focused import tests
38 29 src/application/ReferenceSourceImport.ts:io Reader fails during bounded traversal Reader fails during traversal Raw reader error message May expose filesystem details and inconsistent recovery Reference source files could not be read. Check directory permissions and try again. implemented focused assertions passed
39 30 src/application/ReferenceSourceImport.ts:parse Historical graph validation fails Raw thrown graph validation message Can expose internal graph invariants Reference source could not be indexed. Check that the source tree is readable, then try again. implemented focused assertions passed
40 31 src/application/ReferenceSourceImportTypes.ts:limit Import reports terminal limit failure No reachable constructor found Declared state may be unreachable; false verification risk Remove unreachable top-level limit variant; per-entry limit guidance remains caller-visible. removed verified by typecheck, exhaustive projection test, and source search
41 32 src/application/Setup.ts:configureDetectedClients(backup) Agent configuration backup fails {clientName} configuration backup verification failed; no successful configuration was reported. Exposes machine client key and obscures no-write guarantee Agent configuration could not be backed up, so no change was made. Check file permissions, then rerun setup. implemented focused assertions passed
@@ -1,5 +1,5 @@
{
"manifest_id": "ecm_0107a34d5c39457fbb22d1b86983e97ef618787d676300664cb2bb8c9efa738b",
"manifest_id": "ecm_627d211d59b75217aa6efd6e83458bc616a50657ab1f1a63415b3b343ca6d637",
"verifier": {
"id": "rea-managed-conformance",
"version": "1"
@@ -13,7 +13,7 @@
"skill_digests": [
{
"skill_id": "reverse-engineer-anything",
"sha256": "dad216a904af18f4eb364995c5d70ff691aa2ff2e841a169f583f50bec03530d"
"sha256": "31f5866710faafbf13d13f7f21b652357178b6667dd14ec958e5ecfd24db9a60"
}
],
"claims": [