Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
528da7cc31 | ||
|
|
e9a71efa31 | ||
|
|
fe7bcc3fbe | ||
|
|
736aa946bc | ||
|
|
d929543198 | ||
|
|
e598b4656a | ||
|
|
ec394a2bdf | ||
|
|
7054bbb9ab | ||
|
|
b2257653ca | ||
|
|
b3b5c8b133 | ||
|
|
befbc024c9 | ||
|
|
fc41b24dc4 | ||
|
|
2c90082a69 | ||
|
|
82763824dc | ||
|
|
41e4c06397 | ||
|
|
a5024a9710 | ||
|
|
fc791bb606 | ||
|
|
8ed3d1df72 | ||
|
|
2b5ee72d26 | ||
|
|
2a2a33ad92 | ||
|
|
c7697595d8 | ||
|
|
c9f9b83c6f | ||
|
|
55cef2566a | ||
|
|
f255899ee8 | ||
|
|
65726afaaa | ||
|
|
30ba5e99f9 | ||
|
|
b6529bf1af | ||
|
|
1b8a9c831b | ||
|
|
cb18d4c9c4 | ||
|
|
47b4628bac | ||
|
|
670ad6bd96 | ||
|
|
c61c108b52 | ||
|
|
d7651b6a0d | ||
|
|
e18fccc548 | ||
|
|
e45eb33f03 | ||
|
|
337d2e33c5 | ||
|
|
6688ed6db7 | ||
|
|
c1fd496e6a | ||
|
|
6fcfc5b5e0 | ||
|
|
35e17a7172 | ||
|
|
f8f3593a8c | ||
|
|
ed4a1c7d95 | ||
|
|
7a83af3cba | ||
|
|
f5b1dce881 | ||
|
|
73c72d5745 | ||
|
|
ce89706145 | ||
|
|
3e88e21705 | ||
|
|
d94ef22d70 | ||
|
|
c61a24b8c5 | ||
|
|
fc712b3750 | ||
|
|
ab45bf641e | ||
|
|
57f30029b1 | ||
|
|
22ec8bdb2f | ||
|
|
a715fb9e6d | ||
|
|
85788452dd | ||
|
|
1b036ecbff | ||
|
|
933f216698 | ||
|
|
cf0a38ad97 | ||
|
|
a1ca8c76af | ||
|
|
034342ba28 | ||
|
|
788964d52c | ||
|
|
acca91d22b | ||
|
|
0323ce0a28 | ||
|
|
089ef732e8 | ||
|
|
f09f454f45 | ||
|
|
70cd4cbfb8 | ||
|
|
b7dcf782aa | ||
|
|
4135c911d3 | ||
|
|
0781716788 | ||
|
|
847b7328cf | ||
|
|
baad9eebe4 | ||
|
|
4692bb3330 | ||
|
|
af6a998066 | ||
|
|
7a66470385 | ||
|
|
90c6922905 | ||
|
|
3ded799bc7 | ||
|
|
d69acc3455 | ||
|
|
7d1e4d0e2b | ||
|
|
949228b606 | ||
|
|
5e8f7c536e | ||
|
|
18591f78ae | ||
|
|
44b197f924 | ||
|
|
610f873e91 | ||
|
|
59f528f0e5 | ||
|
|
c553d1138e | ||
|
|
930dd5357f | ||
|
|
084e540414 | ||
|
|
db689f3c3c | ||
|
|
f15ddbea7a | ||
|
|
68081ac414 | ||
|
|
bddeae5108 | ||
|
|
c9764084b8 | ||
|
|
0f966e2b44 | ||
|
|
1851f1fcfd | ||
|
|
2b2a5d0f26 | ||
|
|
2a9252e4e6 | ||
|
|
7666a482b6 |
No files matched your search
@@ -59,7 +59,7 @@ availability have different remedies; avoid repeating setup for all of them.
|
||||
absent, inspect the client's MCP launch error rather than repeating setup.
|
||||
|
||||
REA setup never installs or upgrades Node.js, npm, Homebrew, Java, Ghidra, IDA,
|
||||
JADX, Binwalk, or Unblob. Use existing prerequisites; do not install unrelated
|
||||
JADX, Kuna, Binwalk, or Unblob. Use existing prerequisites; do not install unrelated
|
||||
software to repair
|
||||
MCP registration. For an unsupported client, use manual stdio registration
|
||||
with a version-pinned `rea-agents` package or continue through the CLI.
|
||||
@@ -79,7 +79,7 @@ is within the authorized scope, use `npx -y rea-agents@latest` in its place.
|
||||
Configuration repair starts with a read-only setup plan; show paths, backups and
|
||||
skill replacement before applying authorized changes. Preserve existing approval
|
||||
and target-execution boundaries. REA setup never installs or upgrades unrelated
|
||||
software, including Node.js, npm, Homebrew, Java, Ghidra, IDA, JADX, Binwalk or Unblob.
|
||||
software, including Node.js, npm, Homebrew, Java, Ghidra, IDA, JADX, Kuna, Binwalk or Unblob.
|
||||
|
||||
## Route the target first
|
||||
|
||||
@@ -215,6 +215,20 @@ after opening; IDA does not supply `binary_overview`. Consult session availabili
|
||||
when composing broader workflows. Modern direct callers and unsupported dossier
|
||||
facets remain unknown; live IDA results are not replayed from snapshots.
|
||||
|
||||
With `REA_KUNA_COMMAND` configured, `provider_id: "kuna"` answers procedure
|
||||
lists, lookups, pseudocode, assembly and `analyze_function` from Kuna's cached
|
||||
whole-program export. Callers/callees use a separate body-free graph shared by
|
||||
the session; `xrefs` returns exact-address incoming sites and filters forwarding
|
||||
aliases. These queries and inventory lookups do not trigger a C export. Indirect
|
||||
targets remain unknown and can make relationship coverage partial. Reference
|
||||
caches expire on close; a fresh CLI process repeats the native reference walk.
|
||||
Typed references, CFG, raw-memory tools and annotations remain unsupported. A cold first
|
||||
answer can come from a single-function run (its limitations say so); assembly
|
||||
waits for the export. For pseudocode and assembly, `raw_result.source` names the
|
||||
cached `.c`/`.asm` file and byte span, which you may search directly instead of
|
||||
calling per function. See the
|
||||
[Kuna provider guide](https://github.com/morluto/rea/blob/main/docs/kuna-provider.md).
|
||||
|
||||
If the user says only "my app" without a name, path, or target already selected
|
||||
for this task, ask which app before searching for artifacts. Paths in unrelated
|
||||
saved reports and nearby test fixtures do not select the user's target. Resolve
|
||||
|
||||
@@ -94,6 +94,36 @@ recorded observations, identity, hashes, exports and source ranges; it does not
|
||||
include every child syntax observation, related edge or original source file.
|
||||
An absent item fact is not evidence of absence from the whole application.
|
||||
|
||||
For canonical identities and retained source-range counts, use a typed reference
|
||||
page instead of reading every full item:
|
||||
|
||||
```json
|
||||
{
|
||||
"source": {
|
||||
"kind": "retained-evidence",
|
||||
"evidence_id": "ev_ACTUAL_PARENT_ID"
|
||||
},
|
||||
"view": {
|
||||
"kind": "javascript",
|
||||
"collection": "modules",
|
||||
"projection": "references",
|
||||
"where": { "path": "main.js", "kind": "javascript-module" },
|
||||
"offset": 0,
|
||||
"limit": 16
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Filters match exact retained strings; omit a filter to include all values, use
|
||||
`path: null` for unavailable paths, and `path: ""` for a recorded empty path.
|
||||
Rows preserve canonical `identity` and distinct observation support states in
|
||||
`basis`. `retained_source_range_count` counts retained source-range observations,
|
||||
not runtime imports or unique reference sites. Use a row's `node_id` with the item
|
||||
view above for exact locations and full supporting observations. Follow
|
||||
`coverage.next_offset`; page exhaustion describes matching retained rows only.
|
||||
Check `source_coverage` for source selection, partial/unknown graph coverage and
|
||||
unknown counts before drawing a negative conclusion.
|
||||
|
||||
## Trace only the remaining question
|
||||
|
||||
Use `trace_application_feature` on the parent application Evidence for one
|
||||
|
||||
+949
-41
@@ -1,51 +1,959 @@
|
||||
name: Experimental Windows readonly fixture mutation oracle
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main, "release/*"]
|
||||
schedule:
|
||||
- cron: "23 0-2,4-23 * * *"
|
||||
- cron: "23 3 * * *"
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
source_sha:
|
||||
description: Exact qualification source; must match the caller revision.
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
concurrency:
|
||||
# Complete qualification finishes even while main receives more pushes.
|
||||
# Main feedback also finishes, coalescing newer pushes to one pending run.
|
||||
# Scheduled/manual main runs coalesce to one active and the latest pending;
|
||||
# release and label-triggered qualification use exact-revision groups.
|
||||
group: ci-${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || inputs.source_sha != '' || contains(github.event.pull_request.labels.*.name, 'ci:full')) && 'qualification' || 'feedback' }}-${{ inputs.source_sha || github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' && inputs.source_sha == '' && !contains(github.event.pull_request.labels.*.name, 'ci:full') }}
|
||||
|
||||
env:
|
||||
HUSKY: "0"
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant: [without-normal-fix, fixed]
|
||||
changes:
|
||||
name: Classify changes
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
outputs:
|
||||
tier: ${{ steps.plan.outputs.tier }}
|
||||
qualification_run_id: ${{ steps.qualification.outputs.run_id }}
|
||||
code: ${{ steps.plan.outputs.code }}
|
||||
reverse_tools: ${{ steps.plan.outputs.reverse_tools }}
|
||||
sqlite: ${{ steps.plan.outputs.sqlite }}
|
||||
runtime: ${{ steps.plan.outputs.runtime }}
|
||||
package: ${{ steps.plan.outputs.package }}
|
||||
apple: ${{ steps.plan.outputs.apple }}
|
||||
fixtures: ${{ steps.plan.outputs.fixtures }}
|
||||
readiness: ${{ steps.plan.outputs.readiness }}
|
||||
docs: ${{ steps.plan.outputs.docs }}
|
||||
workflows: ${{ steps.plan.outputs.workflows }}
|
||||
browser: ${{ steps.plan.outputs.browser }}
|
||||
binary_layout: ${{ steps.plan.outputs.binary_layout }}
|
||||
evm: ${{ steps.plan.outputs.evm }}
|
||||
javascript_recovery: ${{ steps.plan.outputs.javascript_recovery }}
|
||||
recorded_crash: ${{ steps.plan.outputs.recorded_crash }}
|
||||
web_network: ${{ steps.plan.outputs.web_network }}
|
||||
web_runtime: ${{ steps.plan.outputs.web_runtime }}
|
||||
web_source_map: ${{ steps.plan.outputs.web_source_map }}
|
||||
nativeaot: ${{ steps.plan.outputs.nativeaot }}
|
||||
website: ${{ steps.plan.outputs.website }}
|
||||
matrix: ${{ steps.plan.outputs.matrix }}
|
||||
test_selection: ${{ steps.plan.outputs.test_selection }}
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
ref: ${{ inputs.source_sha || github.sha }}
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- run: npm ci
|
||||
- run: npm run build:cached
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
run-id: ${{ matrix.variant == 'fixed' && '38662148662' || '38660840144' }}
|
||||
name: windows-creation-owner-native-fixed
|
||||
path: native/windows/build/
|
||||
- name: Verify permanent fixture detects missing NORMAL fallback
|
||||
shell: bash
|
||||
- name: Bind qualification to the caller revision
|
||||
if: inputs.source_sha != ''
|
||||
env:
|
||||
EXPECTED_VARIANT: ${{ matrix.variant }}
|
||||
SOURCE_SHA: ${{ inputs.source_sha }}
|
||||
run: |
|
||||
node --input-type=module <<'JS'
|
||||
import assert from 'node:assert/strict';
|
||||
import {spawnSync} from 'node:child_process';
|
||||
const result=spawnSync(process.execPath,['scripts/verify-windows-native.mjs','.'],{encoding:'utf8',timeout:180000});
|
||||
if(result.error)throw result.error;
|
||||
process.stdout.write(result.stdout);
|
||||
process.stderr.write(result.stderr);
|
||||
if(process.env.EXPECTED_VARIANT==='fixed'){
|
||||
assert.equal(result.status,0);
|
||||
const observed=JSON.parse(result.stdout.trim());
|
||||
assert.equal(observed.ok,true);
|
||||
assert.equal(observed.controls.readonlyFileWithoutArchiveAttributeRemoved,true);
|
||||
}else{
|
||||
assert.notEqual(result.status,0);
|
||||
assert.match(result.stderr,/Delete owned object by handle failed/);
|
||||
assert.match(result.stderr,/Win32 5/);
|
||||
}
|
||||
console.log(JSON.stringify({ok:true,variant:process.env.EXPECTED_VARIANT,permanentVerifierStatus:result.status,baselineMissingNormalDetected:process.env.EXPECTED_VARIANT!=='fixed'}));
|
||||
JS
|
||||
test "${SOURCE_SHA}" = "${GITHUB_SHA}"
|
||||
test "${SOURCE_SHA}" = "$(git rev-parse HEAD)"
|
||||
- name: Find a verified ancestor for push selection
|
||||
id: baseline
|
||||
if: github.event_name == 'push' && inputs.source_sha == ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
HEAD_SHA: ${{ github.sha }}
|
||||
CI_REPOSITORY: ${{ github.repository }}
|
||||
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
run: node scripts/ci/baseline.mjs
|
||||
- name: Admit scheduled full qualification
|
||||
id: qualification
|
||||
if: github.event_name == 'schedule' && inputs.source_sha == ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
HEAD_SHA: ${{ github.sha }}
|
||||
CI_REPOSITORY: ${{ github.repository }}
|
||||
CI_REPOSITORY_ID: ${{ github.repository_id }}
|
||||
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
CI_FORCE_FULL: ${{ github.event.schedule == '23 3 * * *' }}
|
||||
run: node scripts/ci/qualification.mjs
|
||||
- name: Select verification lanes
|
||||
id: plan
|
||||
env:
|
||||
BASE_SHA: ${{ steps.baseline.outputs.base || github.event.pull_request.base.sha }}
|
||||
BASELINE_REASON: ${{ steps.baseline.outputs.reason }}
|
||||
HEAD_SHA: ${{ inputs.source_sha || github.event.pull_request.head.sha || github.sha }}
|
||||
CI_FULL: ${{ inputs.source_sha != '' || contains(github.event.pull_request.labels.*.name, 'ci:full') }}
|
||||
CI_SKIP_FULL: ${{ steps.qualification.outputs.run_full == 'false' }}
|
||||
run: node scripts/ci/plan.mjs
|
||||
|
||||
static:
|
||||
name: Static checks
|
||||
needs: changes
|
||||
if: ${{ !cancelled() && needs.changes.outputs.tier != 'reused' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Require successful change classification
|
||||
env:
|
||||
CHANGES_RESULT: ${{ needs.changes.result }}
|
||||
run: test "${CHANGES_RESULT}" = "success"
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- name: Restore static task cache
|
||||
if: needs.changes.outputs.code == 'true'
|
||||
id: static-cache
|
||||
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||
with:
|
||||
path: .turbo/cache/
|
||||
key: rea-static-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc', '.npmrc', 'package-lock.json') }}-${{ github.sha }}
|
||||
# Turbo validates each task's inputs after restoring this snapshot.
|
||||
restore-keys: rea-static-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.nvmrc', '.npmrc', 'package-lock.json') }}-
|
||||
- name: Validate workflow syntax and expressions
|
||||
if: needs.changes.outputs.workflows == 'true'
|
||||
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 -shellcheck= -pyflakes=
|
||||
- name: Record static task source and execution identity
|
||||
continue-on-error: true
|
||||
if: needs.changes.outputs.code == 'true'
|
||||
env:
|
||||
CI_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: npm run ci:static-context
|
||||
- if: needs.changes.outputs.code == 'true'
|
||||
run: npm run check:ci
|
||||
- if: needs.changes.outputs.code == 'true'
|
||||
run: npm run verify:test-discovery
|
||||
- name: Check LLDB producer retention and launch contracts
|
||||
if: needs.changes.outputs.code == 'true'
|
||||
run: npm run test:python
|
||||
- if: needs.changes.outputs.code != 'true'
|
||||
run: npm run format:check
|
||||
- name: Save validated static task cache
|
||||
if: >-
|
||||
success() && needs.changes.outputs.code == 'true' &&
|
||||
steps.npm-cache.outputs.can-save == 'true' &&
|
||||
steps.static-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||
with:
|
||||
path: .turbo/cache/
|
||||
key: ${{ steps.static-cache.outputs.cache-primary-key }}
|
||||
- name: Upload complete static diagnostics
|
||||
if: always() && needs.changes.outputs.code == 'true'
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: static-check-reports
|
||||
path: .cache/static-checks/
|
||||
include-hidden-files: true
|
||||
if-no-files-found: ignore
|
||||
retention-days: 7
|
||||
|
||||
test-source:
|
||||
name: Source tests
|
||||
needs: changes
|
||||
if: needs.changes.outputs.code == 'true' && needs.changes.outputs.tier == 'fast'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- name: Run source tests without waiting for build
|
||||
run: npm run test:fast -- --reporter=default --reporter=blob
|
||||
env:
|
||||
VITEST_BLOB_LABEL: source
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
if: ${{ !cancelled() }}
|
||||
with:
|
||||
name: vitest-report-source
|
||||
path: .vitest/blob/*
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
test-shard:
|
||||
name: Test shard (${{ matrix.shard }})
|
||||
needs: [changes, build]
|
||||
if: needs.changes.outputs.code == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
# Failed PRs release the remaining matrix slots; qualification retains
|
||||
# every shard's diagnostics and coverage. Passing PRs run the full suite.
|
||||
fail-fast: ${{ github.event_name == 'pull_request' && needs.changes.outputs.tier == 'fast' }}
|
||||
matrix:
|
||||
# Fast feedback spends the same six test jobs on one source group and
|
||||
# five built groups; full qualification retains six complete shards.
|
||||
shard: ${{ fromJSON(needs.changes.outputs.tier == 'fast' && '["1/5","2/5","3/5","4/5","5/5"]' || '["1/6","2/6","3/6","4/6","5/6","6/6"]') }}
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: rea-test-runtime
|
||||
path: .
|
||||
- name: Run complete portable suite with coverage
|
||||
if: needs.changes.outputs.tier == 'full'
|
||||
run: npm run test:ci:shard:run -- --shard=${{ matrix.shard }}
|
||||
env:
|
||||
REA_CI_TEST_HISTORY: .cache/ci-test-history/test-results.json
|
||||
- name: Run built-dependent tests for fast feedback
|
||||
if: needs.changes.outputs.tier == 'fast'
|
||||
run: npm run test:built -- --reporter=default --reporter=blob --shard=${{ matrix.shard }}
|
||||
env:
|
||||
VITEST_BLOB_LABEL: built
|
||||
REA_CI_TEST_HISTORY: .cache/ci-test-history/test-results.json
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
if: ${{ !cancelled() }}
|
||||
with:
|
||||
name: vitest-report-built-${{ strategy.job-index }}
|
||||
path: .vitest/blob/*
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
retention-days: 7
|
||||
|
||||
reverse-tools-quality:
|
||||
name: Reverse tools quality
|
||||
needs: [changes, static]
|
||||
if: needs.changes.outputs.reverse_tools == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- name: Run reverse tools tests with coverage
|
||||
run: npm run test:coverage:reverse-tools
|
||||
- name: Preflight both reverse tools mutation configurations
|
||||
run: |
|
||||
node scripts/prepare-reverse-tools-mutation.mjs
|
||||
npx --no-install stryker run stryker.config.mjs --dryRunOnly
|
||||
npx --no-install stryker run stryker.semantics.config.mjs --dryRunOnly
|
||||
- name: Retain available reverse tools diagnostics
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: reverse-tools-quality-${{ needs.changes.outputs.tier }}-${{ github.run_attempt }}
|
||||
path: |
|
||||
coverage/reverse-tools/
|
||||
reports/mutation/
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
build:
|
||||
name: Build package
|
||||
needs: changes
|
||||
# Reusable provider workflows consume this run's portable build artifact,
|
||||
# even when a workflow-only edit selects the lane without portable tests.
|
||||
if: >-
|
||||
needs.changes.outputs.code == 'true' ||
|
||||
needs.changes.outputs.browser == 'true' ||
|
||||
needs.changes.outputs.binary_layout == 'true' ||
|
||||
needs.changes.outputs.evm == 'true' ||
|
||||
needs.changes.outputs.javascript_recovery == 'true' ||
|
||||
needs.changes.outputs.recorded_crash == 'true' ||
|
||||
needs.changes.outputs.web_network == 'true' ||
|
||||
needs.changes.outputs.web_runtime == 'true' ||
|
||||
needs.changes.outputs.web_source_map == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- name: Reuse portable build outputs across runs
|
||||
uses: ./.github/actions/portable-build-cache
|
||||
with:
|
||||
save: ${{ github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
|
||||
- run: npm run test:prepare
|
||||
- name: Find available trusted full-suite timing history
|
||||
id: history
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
CI_REPOSITORY: ${{ github.repository }}
|
||||
CI_REPOSITORY_ID: ${{ github.repository_id }}
|
||||
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
run: node scripts/ci/test-history.mjs
|
||||
- name: Download previous timing report
|
||||
if: steps.history.outputs.run-id != ''
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: test-timings
|
||||
run-id: ${{ steps.history.outputs.run-id }}
|
||||
github-token: ${{ github.token }}
|
||||
path: .cache/ci-test-history
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: rea-test-runtime
|
||||
path: |
|
||||
dist/
|
||||
skills/
|
||||
.cache/mcp-tool-catalog.json
|
||||
.cache/ci-test-history/test-results.json
|
||||
docs/public/product-catalog.json
|
||||
docs/verification/managed-conformance-*.json
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
# test:prepare caches only portable JS, skill, and catalog outputs.
|
||||
# Native package jobs still run their build and prepack checks; Turbo
|
||||
# restores matching outputs or rebuilds when their inputs differ.
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: rea-build-cache
|
||||
path: .turbo/cache/
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
sqlite-runtime:
|
||||
# Preserve all selected coverage, but admit expensive host/provider work
|
||||
# only after static validation. Portable tests still provide early feedback.
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.sqlite == 'true'
|
||||
uses: ./.github/workflows/sqlite-runtime.yml
|
||||
|
||||
test:
|
||||
name: Portable tests
|
||||
needs: [changes, test-source, test-shard]
|
||||
if: ${{ !cancelled() && needs.changes.outputs.tier != 'reused' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Require successful change classification
|
||||
env:
|
||||
CHANGES_RESULT: ${{ needs.changes.result }}
|
||||
run: test "${CHANGES_RESULT}" = "success"
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
if: needs.changes.outputs.code == 'true' && success()
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
if: needs.changes.outputs.code == 'true' && success()
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
if: needs.changes.outputs.code == 'true' && success()
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- if: needs.changes.outputs.code == 'true' && success()
|
||||
run: npm ci
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
if: >-
|
||||
!cancelled() && needs.changes.outputs.code == 'true' &&
|
||||
(needs.test-shard.result == 'success' || needs.test-shard.result == 'failure' ||
|
||||
(needs.changes.outputs.tier == 'fast' &&
|
||||
(needs.test-source.result == 'success' || needs.test-source.result == 'failure')))
|
||||
with:
|
||||
path: .vitest/blob
|
||||
pattern: vitest-report-*
|
||||
merge-multiple: true
|
||||
- name: Merge coverage, JUnit, and timing reports
|
||||
id: merge
|
||||
if: >-
|
||||
!cancelled() && needs.changes.outputs.code == 'true' &&
|
||||
needs.changes.outputs.tier == 'full' &&
|
||||
(needs.test-shard.result == 'success' || needs.test-shard.result == 'failure')
|
||||
run: >-
|
||||
npm run test:ci:merge --
|
||||
--coverage.reportsDirectory=coverage
|
||||
--coverage.reporter=text
|
||||
--coverage.reporter=json-summary
|
||||
--coverage.reporter=lcov
|
||||
--reporter=default
|
||||
--reporter=junit
|
||||
--reporter=json
|
||||
--reporter=./scripts/ci/test-timing-reporter.mjs
|
||||
--outputFile.junit=test-results.xml
|
||||
--outputFile.json=test-results.json
|
||||
- name: Merge fast-suite JUnit and timing reports
|
||||
id: merge-fast
|
||||
if: >-
|
||||
!cancelled() && needs.changes.outputs.code == 'true' &&
|
||||
needs.changes.outputs.tier == 'fast' &&
|
||||
(needs.test-shard.result == 'success' || needs.test-shard.result == 'failure' ||
|
||||
needs.test-source.result == 'success' || needs.test-source.result == 'failure')
|
||||
run: >-
|
||||
npm exec -- vitest --merge-reports
|
||||
--reporter=default
|
||||
--reporter=junit
|
||||
--reporter=json
|
||||
--reporter=./scripts/ci/test-timing-reporter.mjs
|
||||
--outputFile.junit=test-results.xml
|
||||
--outputFile.json=test-results.json
|
||||
- name: Summarize slowest test files
|
||||
if: needs.changes.outputs.code == 'true' && !cancelled()
|
||||
env:
|
||||
SHARD_RESULT: ${{ needs.test-shard.result }}
|
||||
SOURCE_REQUIRED: ${{ needs.changes.outputs.tier == 'fast' }}
|
||||
SOURCE_RESULT: ${{ needs.test-source.result }}
|
||||
MERGE_RESULT: ${{ needs.changes.outputs.tier == 'full' && steps.merge.outcome || steps.merge-fast.outcome }}
|
||||
CI_VERIFY_TEST_INVENTORY: "true"
|
||||
CI_TEST_SELECTION: ${{ needs.changes.outputs.test_selection }}
|
||||
CI_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: node scripts/ci/test-report.mjs
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
if: needs.changes.outputs.code == 'true' && !cancelled() && hashFiles('test-results.json') != ''
|
||||
with:
|
||||
name: test-results
|
||||
path: |
|
||||
test-results.xml
|
||||
test-results.json
|
||||
test-timings.json
|
||||
coverage/
|
||||
.cache/ci-test-selection/report.json
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
- name: Publish successful timing history
|
||||
if: needs.changes.outputs.code == 'true' && needs.changes.outputs.tier == 'full' && success() && needs.test-shard.result == 'success'
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: test-timings
|
||||
path: .cache/ci-test-history/test-results.json
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
- name: Require successful test shards
|
||||
if: ${{ !cancelled() }}
|
||||
env:
|
||||
CODE_REQUIRED: ${{ needs.changes.outputs.code }}
|
||||
SHARD_RESULT: ${{ needs.test-shard.result }}
|
||||
SOURCE_REQUIRED: ${{ needs.changes.outputs.tier == 'fast' }}
|
||||
SOURCE_RESULT: ${{ needs.test-source.result }}
|
||||
run: |
|
||||
if [ "${CODE_REQUIRED}" = "true" ]; then
|
||||
test "${SHARD_RESULT}" = "success" || exit 1
|
||||
test "${SOURCE_REQUIRED}" != "true" || test "${SOURCE_RESULT}" = "success"
|
||||
fi
|
||||
|
||||
conformance-fixtures:
|
||||
name: Source-built conformance fixtures
|
||||
needs: [changes, static]
|
||||
if: needs.changes.outputs.fixtures == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- name: Verify fixtures from a clean checkout
|
||||
run: npm run verify:fixtures
|
||||
|
||||
windows-native-build:
|
||||
name: Build bundled Windows x64 native controls
|
||||
needs: [changes, static]
|
||||
if: needs.changes.outputs.runtime == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Prepare cross compiler
|
||||
run: |
|
||||
# Slow Azure archive transfers can exhaust the job before compilation.
|
||||
# Keep the same signed packages and avoid slow HTTP mirror fallback.
|
||||
for source in /etc/apt/apt-mirrors.txt /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do
|
||||
if [ -f "$source" ]; then
|
||||
sudo sed -i 's|azure.archive.ubuntu.com|archive.ubuntu.com|g; s|http://archive.ubuntu.com|https://archive.ubuntu.com|g' "$source"
|
||||
fi
|
||||
done
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y g++-mingw-w64-x86-64
|
||||
- run: npm run build:windows-native
|
||||
- run: npm run verify:windows-native:artifact
|
||||
- run: node scripts/build-windows-native.mjs --inspection-fixture
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: windows-native-inspection-fixture
|
||||
path: .cache/windows-native-inspection-fixture/
|
||||
if-no-files-found: error
|
||||
# The process boundary observations are independent of the addon: they
|
||||
# report the caller's and child's own token, environment and breakaway
|
||||
# results from a separate executable. Cross-build it in the lane that
|
||||
# already has MinGW so the Windows job can observe them too.
|
||||
- name: Build Windows process boundary fixture
|
||||
run: |
|
||||
mkdir -p .cache/windows-process-boundary
|
||||
x86_64-w64-mingw32-g++ -municode -std=c++17 -O2 -static -Wall -Wextra \
|
||||
-o .cache/windows-process-boundary/process-boundary.exe \
|
||||
tests/fixtures/windows/processBoundary.cc -ladvapi32
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: windows-process-boundary-fixture
|
||||
path: .cache/windows-process-boundary/
|
||||
if-no-files-found: error
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: windows-native-controls
|
||||
path: native/windows/build/
|
||||
if-no-files-found: error
|
||||
|
||||
package-e2e:
|
||||
name: Native package baseline (${{ matrix.platform }} ${{ matrix.architecture }})
|
||||
needs: [changes, static, build, windows-native-build]
|
||||
if: needs.changes.outputs.runtime == 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
# The four platform jobs use independent hosted runners; keep each
|
||||
# runner's existing heap and threadpool limits while avoiding a queued
|
||||
# second platform wave.
|
||||
max-parallel: 4
|
||||
matrix: ${{ fromJSON(needs.changes.outputs.matrix) }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
NODE_OPTIONS: "--max-old-space-size=1024"
|
||||
UV_THREADPOOL_SIZE: "2"
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- name: Verify native runtime identity
|
||||
env:
|
||||
EXPECTED_CI_PLATFORM: ${{ matrix.platform }}
|
||||
EXPECTED_CI_ARCHITECTURE: ${{ matrix.architecture }}
|
||||
run: >-
|
||||
node -e "const assert = require('node:assert/strict');
|
||||
assert.equal(process.platform, process.env.EXPECTED_CI_PLATFORM);
|
||||
assert.equal(process.arch, process.env.EXPECTED_CI_ARCHITECTURE);
|
||||
console.log(JSON.stringify({ platform: process.platform, architecture: process.arch, node: process.version }));"
|
||||
- run: npm ci
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: rea-build-cache
|
||||
path: .turbo/cache/
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: windows-native-controls
|
||||
path: native/windows/build/
|
||||
- run: npm run verify:windows-native:artifact
|
||||
- name: Verify NativeAOT diagnostic applicability on this host
|
||||
run: npm run test:focused -- tests/evaluation/package/nativeAotDiagnostics.test.ts
|
||||
- run: npm run verify:package
|
||||
env:
|
||||
npm_config_cache: ${{ steps.npm-cache.outputs.path }}
|
||||
REA_VERIFIED_PACKAGE_DIRECTORY: ${{ needs.changes.outputs.tier == 'full' && matrix.platform == 'linux' && matrix.architecture == 'x64' && '.cache/verified-package' || '' }}
|
||||
- name: Verify real Node Inspector discovery and observation
|
||||
timeout-minutes: 10
|
||||
run: npm run verify:inspector
|
||||
- name: Retain the exact qualified release package
|
||||
if: needs.changes.outputs.tier == 'full' && matrix.platform == 'linux' && matrix.architecture == 'x64'
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: verified-release-package
|
||||
path: .cache/verified-package/
|
||||
include-hidden-files: true
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
retention-days: 7
|
||||
|
||||
apple-artifacts:
|
||||
name: Real Apple artifact CLI/MCP E2E
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.apple == 'true'
|
||||
runs-on: macos-15
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: rea-build-cache
|
||||
path: .turbo/cache/
|
||||
- name: Verify Apple artifact formats and metadata
|
||||
env:
|
||||
REA_ARTIFACT_NODE_COMPILE_CACHE: ${{ runner.temp }}/rea-artifact-node-cache
|
||||
run: |
|
||||
npm run verify:keyed-archive
|
||||
npm run verify:asset-catalog
|
||||
npm run verify:macos-bundle
|
||||
npm run verify:legacy-simulator
|
||||
npm run verify:apple-dispatch
|
||||
npm run verify:interface-builder
|
||||
- name: Run native Apple and process boundary regressions
|
||||
run: >-
|
||||
npm run test:focused --
|
||||
tests/boundary/filesystem/installScript.test.ts
|
||||
tests/boundary/filesystem/nibNativeHierarchy.test.ts
|
||||
tests/boundary/filesystem/interfaceBuilderBundle.test.ts
|
||||
tests/boundary/cli/nativePlistCli.test.ts
|
||||
tests/boundary/cli/nativePlistPrototypeKeyCli.test.ts
|
||||
tests/boundary/cli/nativePlistSelectionFailureCli.test.ts
|
||||
tests/boundary/cli/nativeDemangleCli.test.ts
|
||||
tests/boundary/mcp/nativeDemangleMcp.test.ts
|
||||
tests/boundary/providers/native/nativeSignatureTargetBinding.test.ts
|
||||
tests/boundary/cli/nativeSignatureCli.test.ts
|
||||
tests/boundary/mcp/nativeSignatureTargetBindingMcp.test.ts
|
||||
src/process/capture/FilesystemSnapshot.test.ts
|
||||
tests/process-global/filesystemSnapshotFallbackCancellation.test.ts
|
||||
tests/boundary/process/darwinProcessRunTokenReader.test.ts
|
||||
tests/boundary/process/directAnalysisSignals.test.ts
|
||||
tests/boundary/process/processCaptureLifecycle.test.ts
|
||||
tests/boundary/process/processCli.test.ts
|
||||
tests/boundary/mcp/sessionMcp.test.ts
|
||||
|
||||
reconstruction-readiness:
|
||||
name: Reconstruction readiness
|
||||
needs: [changes, static]
|
||||
if: needs.changes.outputs.readiness == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- name: Run the public CLI/MCP reconstruction journey
|
||||
env:
|
||||
REA_READINESS_REPORT_PATH: readiness-report.json
|
||||
run: |
|
||||
set -o pipefail
|
||||
npm run verify:readiness | tee readiness-summary.json
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
if: ${{ !cancelled() }}
|
||||
with:
|
||||
name: reconstruction-readiness
|
||||
path: |
|
||||
readiness-summary.json
|
||||
readiness-report.json
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
windows-curated:
|
||||
name: Windows capability and package lane
|
||||
needs: [changes, static, build, windows-native-build]
|
||||
if: needs.changes.outputs.package == 'true'
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 25
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: rea-build-cache
|
||||
path: .turbo/cache/
|
||||
- run: npm run build:cached
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: windows-native-controls
|
||||
path: native/windows/build/
|
||||
- run: npm run verify:windows-native:artifact
|
||||
- name: Record named Windows host capabilities
|
||||
run: node scripts/windows-capabilities.mjs | Out-File -Encoding utf8NoBOM windows-capabilities.json
|
||||
- name: Validate Windows host capability report
|
||||
run: >-
|
||||
node -e "const report = JSON.parse(require('node:fs').readFileSync('windows-capabilities.json', 'utf8'));
|
||||
if (report.platform !== 'win32' || report.architecture !== 'x64')
|
||||
throw new Error('expected a Windows x64 capability report');"
|
||||
# Keep this list aligned with tests/process-global/curatedWindowsLane.test.ts,
|
||||
# which fails when any path below is renamed or removed. Vitest silently
|
||||
# ignores unmatched paths, so a stale entry would otherwise report green
|
||||
# while skipping coverage.
|
||||
#
|
||||
# The matching native artifact establishes real Job Object and private
|
||||
# runtime boundaries for these fixtures. Ghidra and Java are not needed;
|
||||
# real engine claims remain in the separate controlled-provider workflow.
|
||||
- name: Run curated Windows capability tests
|
||||
run: >-
|
||||
npx vitest run --coverage.enabled=false
|
||||
src/process/capture/FilesystemSnapshot.test.ts
|
||||
tests/process-global/filesystemSnapshotFallbackCancellation.test.ts
|
||||
tests/boundary/filesystem/binaryTarget.test.ts
|
||||
tests/boundary/filesystem/safeOutputTree.test.ts
|
||||
tests/boundary/providers/native/artifactProvider.archiveSafety.test.ts
|
||||
tests/boundary/providers/native/artifactProvider.extractionCompleteness.test.ts
|
||||
tests/boundary/filesystem/setupUnavailableProvider.test.ts
|
||||
tests/boundary/filesystem/windowsNpxRegistration.test.ts
|
||||
tests/boundary/android/workspaceGuardianRetry.test.ts
|
||||
tests/acceptance/setup/homeDirectoryFallback.test.ts
|
||||
tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts
|
||||
tests/boundary/filesystem/webScriptManifestPaths.test.ts
|
||||
tests/boundary/process/ProcessEvidence.host.test.ts
|
||||
tests/boundary/process/windowsOutputCapture.test.ts
|
||||
tests/acceptance/webModuleCli.test.ts
|
||||
tests/acceptance/webSourceLocationCli.test.ts
|
||||
tests/boundary/cli/referenceSourceImportStatus.test.ts
|
||||
tests/boundary/filesystem/asarInventoryFreshness.test.ts
|
||||
tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts
|
||||
tests/conformance/providers/ghidra/windowsCapabilities.test.ts
|
||||
src/ghidra/GhidraInstallation.test.ts
|
||||
tests/boundary/filesystem/ghidraJavaProbe.test.ts
|
||||
tests/boundary/providers/ghidra/ghidraTransport.test.ts
|
||||
tests/boundary/providers/ghidra/ghidraTargetSnapshot.test.ts
|
||||
tests/boundary/providers/ghidra/ghidraLauncher.test.ts
|
||||
tests/boundary/providers/hopper/hopperClient.cleanupRetry.test.ts
|
||||
src/windows/WindowsNativeLoader.test.ts
|
||||
src/windows/WindowsOwnedProcess.test.ts
|
||||
src/ghidra/GhidraLauncherEnvironment.test.ts
|
||||
src/process/ProcessOwnership.test.ts
|
||||
src/process/ProcessOwnership.part2.test.ts
|
||||
src/process/ProcessOwnership.part3.test.ts
|
||||
src/process/ProcessOwnership.validation.test.ts
|
||||
src/application/Update.test.ts
|
||||
tests/process-global/updateMaintenance.test.ts
|
||||
tests/conformance/providers/ghidra/realGhidraWindowsWorkflow.test.ts
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: windows-process-boundary-fixture
|
||||
path: .cache/windows-process-boundary/
|
||||
# Passing the fixture adds the breakaway, caller/child token, environment
|
||||
# semantics and ancestor reparse observations, which the lane skips
|
||||
# entirely when it is absent.
|
||||
- run: >-
|
||||
npm run verify:windows-native -- .
|
||||
"${{ github.workspace }}\.cache\windows-process-boundary\process-boundary.exe"
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: windows-native-inspection-fixture
|
||||
path: .cache/windows-native-inspection-fixture/
|
||||
- name: Verify native inspection failure ownership and recovery
|
||||
run: node scripts/verify-windows-native-inspection.mjs
|
||||
- name: Verify real Node Inspector discovery and observation
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
NODE_OPTIONS: "--max-old-space-size=1024"
|
||||
UV_THREADPOOL_SIZE: "2"
|
||||
run: npm run verify:inspector
|
||||
- run: npm run verify:package:windows
|
||||
- name: Verify native directory identity on Node 24
|
||||
run: >-
|
||||
npx vitest run --coverage.enabled=false
|
||||
tests/boundary/filesystem/directoryArtifactReaderOpen.test.ts
|
||||
tests/boundary/filesystem/javascriptPackagePrecedence.test.ts
|
||||
tests/boundary/filesystem/javascriptArtifactContentIdentity.test.ts
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 22.19.0
|
||||
- name: Verify native path boundaries on Node 22
|
||||
run: >-
|
||||
npx vitest run --coverage.enabled=false
|
||||
tests/boundary/filesystem/directoryArtifactReaderOpen.test.ts
|
||||
tests/boundary/filesystem/javascriptPackagePrecedence.test.ts
|
||||
tests/boundary/filesystem/javascriptArtifactContentIdentity.test.ts
|
||||
tests/boundary/process/sourceMapUncHosts.test.ts
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
if: always()
|
||||
with:
|
||||
name: windows-capabilities
|
||||
path: windows-capabilities.json
|
||||
retention-days: 30
|
||||
|
||||
docs:
|
||||
name: Docs Generation
|
||||
needs: changes
|
||||
if: needs.changes.outputs.docs == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Cache npm package downloads
|
||||
id: npm-cache
|
||||
uses: ./.github/actions/npm-cache
|
||||
- run: npm ci
|
||||
- run: npm run docs:check
|
||||
- name: Generation leaves authored files unchanged
|
||||
run: git diff --exit-code
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: generated-docs
|
||||
path: |
|
||||
docs/public/product-catalog.json
|
||||
docs/verification/managed-conformance-*.json
|
||||
skills/reverse-engineer-anything
|
||||
if-no-files-found: error
|
||||
|
||||
browser:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.browser == 'true'
|
||||
uses: ./.github/workflows/real-browser.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
binary_layout:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.binary_layout == 'true'
|
||||
uses: ./.github/workflows/real-binary-layout.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
evm:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.evm == 'true'
|
||||
uses: ./.github/workflows/real-evm-interface.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
javascript_recovery:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.javascript_recovery == 'true'
|
||||
uses: ./.github/workflows/real-javascript-recovery.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
recorded_crash:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.recorded_crash == 'true'
|
||||
uses: ./.github/workflows/real-recorded-crash.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
web_network:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.web_network == 'true'
|
||||
uses: ./.github/workflows/real-web-network-captures.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
web_runtime:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.web_runtime == 'true'
|
||||
uses: ./.github/workflows/real-web-runtime.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
web_source_map:
|
||||
needs: [changes, static, build]
|
||||
if: needs.changes.outputs.web_source_map == 'true'
|
||||
uses: ./.github/workflows/real-web-source-map.yml
|
||||
with:
|
||||
build_cache_artifact: rea-build-cache
|
||||
|
||||
nativeaot:
|
||||
needs: [changes, static]
|
||||
if: needs.changes.outputs.nativeaot == 'true'
|
||||
uses: ./.github/workflows/nativeaot-fixtures.yml
|
||||
|
||||
website:
|
||||
needs: [changes, static]
|
||||
if: needs.changes.outputs.website == 'true'
|
||||
uses: ./.github/workflows/website-check.yml
|
||||
|
||||
required:
|
||||
name: CI required
|
||||
# Report failed dependencies, but release superseded PR concurrency slots.
|
||||
if: ${{ !cancelled() }}
|
||||
needs:
|
||||
[
|
||||
changes,
|
||||
static,
|
||||
build,
|
||||
reverse-tools-quality,
|
||||
test-shard,
|
||||
test-source,
|
||||
sqlite-runtime,
|
||||
test,
|
||||
conformance-fixtures,
|
||||
windows-native-build,
|
||||
package-e2e,
|
||||
apple-artifacts,
|
||||
reconstruction-readiness,
|
||||
windows-curated,
|
||||
docs,
|
||||
browser,
|
||||
binary_layout,
|
||||
evm,
|
||||
javascript_recovery,
|
||||
recorded_crash,
|
||||
web_network,
|
||||
web_runtime,
|
||||
web_source_map,
|
||||
nativeaot,
|
||||
website,
|
||||
]
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Require every selected lane to pass
|
||||
id: gate
|
||||
env:
|
||||
CI_JOBS: ${{ toJSON(needs) }}
|
||||
CI_QUALIFICATION_DIRECTORY: .cache/ci-qualification
|
||||
run: node scripts/ci/required.mjs
|
||||
- name: Upload full qualification receipt artifact
|
||||
if: needs.changes.outputs.tier == 'full' && success()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: ${{ steps.gate.outputs.receipt_name }}
|
||||
path: ${{ steps.gate.outputs.receipt_path }}
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
retention-days: 7
|
||||
@@ -205,7 +205,8 @@ or update either provider.
|
||||
|
||||
Native formats and host support vary by provider. See
|
||||
[Hopper and Ghidra setup](docs/installation.md#hopper), the
|
||||
[IDA guide](docs/ida-provider.md) (including an optional native MCP bridge), and
|
||||
[IDA guide](docs/ida-provider.md) (including an optional native MCP bridge), the
|
||||
[Kuna decompiler guide](docs/kuna-provider.md), and
|
||||
[experimental Windows Ghidra support](docs/windows-ghidra-p0.md).
|
||||
Ghidra also supports [16-bit DOS analysis](docs/ghidra-dos.md).
|
||||
For large binaries, raise the provider's startup deadline with
|
||||
@@ -344,7 +345,7 @@ Report vulnerabilities through [SECURITY.md](SECURITY.md).
|
||||
|
||||
## Star history
|
||||
|
||||
🎉 **200,000 GitHub stars — thank you!**
|
||||
🎉 **250,000 GitHub stars — thank you!**
|
||||
|
||||
Thanks to everyone using REA, reporting bugs, requesting features, testing builds, and contributing fixes.
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ pin inspection sources; they are not included in the npm package.
|
||||
| ghidra-nativeaot | [MIT](https://github.com/Washi1337/ghidra-nativeaot/blob/effeb734fc570c32650f88b159608979dc7b423e/LICENSE.md) | Pinned inspection source; derived parser attribution above. |
|
||||
| JADX | [Apache-2.0](https://github.com/skylot/jadx/blob/v1.5.6/LICENSE) | The audited jadx-headless-mcp source uses JADX 1.5.6 for Android decompilation; the engine JAR is separately supplied. |
|
||||
| jadx-headless-mcp | [Apache-2.0](https://github.com/1013503897/jadx-headless-mcp/blob/5844800a486d2248fa949b74c9896285f5b54de2/LICENSE) | v0.7.1; pinned submodule and user-supplied JAR. |
|
||||
| Kuna | [Apache-2.0](https://github.com/Noelo-Lab/kuna/blob/v1.833/LICENSE), with its [NOTICE](https://github.com/Noelo-Lab/kuna/blob/v1.833/NOTICE) | Bring your own `kuna`; REA verified 1.833 and never downloads, installs or bundles it. REA invokes it as a separate process. |
|
||||
| Apktool | [Apache-2.0](https://github.com/iBotPeaches/Apktool/blob/master/LICENSE.md) | User-supplied Android resource decoder. |
|
||||
| Binwalk | [MIT](https://github.com/ReFirmLabs/binwalk/blob/4fdab3d464d97b68e0af9088df3f9e2e1545b21c/LICENSE) | v3.1.0; pinned submodule and user-supplied firmware engine. |
|
||||
| Unblob | [MIT](https://github.com/onekey-sec/unblob/blob/1fcc7a0a584a70a96c31f5a276c20944d199a089/LICENSE) | 26.6.4; pinned submodule and user-supplied firmware engine. |
|
||||
|
||||
@@ -60,6 +60,7 @@ export default defineConfig({
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "IDA", link: "/ida-provider" },
|
||||
{ text: "Kuna", link: "/kuna-provider" },
|
||||
{ text: "Ghidra on Windows", link: "/windows-ghidra-p0" },
|
||||
{ text: "Ghidra DOS analysis", link: "/ghidra-dos" },
|
||||
{ text: "Ghidra raw binary", link: "/raw-binary" },
|
||||
|
||||
@@ -343,8 +343,10 @@ an invalid supplied size remains unknown with incomplete resource coverage while
|
||||
the resource's other facts are retained. Zero and nonnegative fractional sizes
|
||||
are preserved.
|
||||
|
||||
CDP discovery, connection, and commands wait for the peer or caller cancellation;
|
||||
a stalled peer can leave an operation waiting. WebSocket messages remain subject
|
||||
CDP discovery has a 10-second deadline. Each WebSocket handshake and command
|
||||
response has its own 20-second deadline, separate from the caller-selected
|
||||
observation window. A stalled handshake or command reports `provider_timeout`;
|
||||
caller cancellation still reports cancellation. WebSocket messages remain subject
|
||||
to the [64 MiB limit](#request-boundary). REA does not impose a message-count or
|
||||
pending-command quota. On cancellation, it closes only its own WebSocket,
|
||||
waiting up to one second before terminating it. Malformed unsolicited events
|
||||
|
||||
@@ -144,6 +144,15 @@ distinction: it closes and deletes provider-owned profiles, but only disconnects
|
||||
from an external CDP browser. Real-browser verification checks both outcomes and
|
||||
confirms that an attached external browser remains alive.
|
||||
|
||||
`environment.locale` sets Intl formatting in both modes. Launch also sets
|
||||
`navigator.language`, `navigator.languages`, and the request `Accept-Language`.
|
||||
Connect preserves the caller's page and request languages; every attached
|
||||
capture identifies this locale limitation, including retained partial
|
||||
observations. Use launch mode when the application must select the requested
|
||||
language through navigator values or request headers. Artifact completeness
|
||||
covers the selected observations, not equivalence of launch and connect
|
||||
language environments.
|
||||
|
||||
HTTP(S) URLs may include ordinary query values and fragments directly. Use
|
||||
ordered structured query entries when a value needs to reference a declared
|
||||
environment-backed secret. Form, storage, and cookie values are either literal
|
||||
|
||||
+11
-3
@@ -95,8 +95,9 @@ dependency edges, and the section's file range. A missing `.dep-v0` section is
|
||||
null metadata, not proof that the binary has no dependencies. See
|
||||
[Rust binaries](rust-binaries.md).
|
||||
|
||||
Configure [Hopper or Ghidra](installation.md#hopper), or the
|
||||
[IDA adapter](ida-provider.md), before analyzing a native target. Substitute
|
||||
Configure [Hopper or Ghidra](installation.md#hopper), the
|
||||
[IDA adapter](ida-provider.md), or [Kuna](kuna-provider.md) before analyzing a
|
||||
native target. Substitute
|
||||
your target, search text and function name or address in these examples:
|
||||
|
||||
```bash
|
||||
@@ -314,7 +315,9 @@ diagnostics appear inside the report when `--full-output` is selected. Log
|
||||
truncation alone does not change the diagnostic health or exit status.
|
||||
|
||||
The default terminal format is TOON. Use `--json` when saving results for a
|
||||
JSON consumer. `--json` is indented on a terminal and compact when piped or
|
||||
JSON consumer. Valued output flags (`--format`, `--filter-output`,
|
||||
`--token-limit`, `--token-offset`) accept `--flag value` or `--flag=value`; a
|
||||
missing value fails with `MISSING_OUTPUT_VALUE` before the command runs. `--json` is indented on a terminal and compact when piped or
|
||||
redirected, which keeps large results smaller for agents and scripts; pipe
|
||||
through `jq .` for indented files. Output selection and formatting do not change
|
||||
operation status.
|
||||
@@ -352,6 +355,11 @@ command, objdump, Rizin and GDB. In these paths, a returned structured
|
||||
signal-derived status. This describes the current source routing; it is not a
|
||||
claim that every command or provider runtime has been independently exercised.
|
||||
|
||||
When the reader of piped output closes early, as `rea ... | head` does, the
|
||||
CLI stops writing, prints no error and exits `141` (`128 + 13`, the status of a
|
||||
SIGPIPE-terminated writer). The operation itself may have completed; only its
|
||||
output was declined.
|
||||
|
||||
`inspect-artifact` also returns a structured cancelled result, but its direct
|
||||
analysis cancellation path does not set a signal-derived exit status, so it
|
||||
exits `1`. Setup has its own contract: cancellation exits `0`. Treat the
|
||||
|
||||
@@ -116,6 +116,12 @@ If cleanup cannot be verified, the error retains collected observations in
|
||||
`details.partial_observation` and marks their application cleanup `unverified`.
|
||||
Cleanup uncertainty does not authorize signaling unrelated processes.
|
||||
|
||||
### Target fuse prerequisites
|
||||
|
||||
Active scenario capture requires that the target Electron executable honors Node CLI inspector flags (`--inspect` or `--remote-debugging-port`) so that Playwright can establish its DevTools protocol session.
|
||||
|
||||
When an Electron executable explicitly disables the `EnableNodeCliInspectArguments` fuse (or removes the capability), `capture-electron-scenario` fails immediately before process launch with an `AnalysisUnsupportedTargetError` ("unsupported_target") rather than waiting for the startup deadline. For targets with disabled inspector fuses, use passive CDP inspection via `inspect_electron_page` or run against an unrestricted development binary with the extracted `app.asar`.
|
||||
|
||||
The real verifier exercises compiled CLI and stdio MCP discovery, page/script
|
||||
inspection, static/runtime reconciliation, active observation, and CLI SIGTERM
|
||||
cleanup before checking the IPC, renderer crash/reload, utility/child-process,
|
||||
|
||||
@@ -69,6 +69,12 @@ Pass a returned MethodTable address to `inspect_native_data_type`. A direct PE
|
||||
query also derives the snapshot metadata from the authenticated Ghidra session
|
||||
handshake, so it does not require a preceding load-image call. In a persistent
|
||||
MCP session, load-image followed by type inspection reuses that same derivation.
|
||||
The bridge resolves the caller's address spelling once; metadata lookup uses
|
||||
its canonical default-space identity. Bare hexadecimal, prefixed hexadecimal,
|
||||
and encoded default-space selectors therefore select the same MethodTable.
|
||||
Other address spaces and unresolved identities are not matched by offset alone.
|
||||
Metadata already supplied by the engine is retained without reading or deriving
|
||||
an additional source snapshot.
|
||||
The database result remains `unavailable` when Ghidra has no DataType at that
|
||||
address; its `metadata_recovery.source` is `read-only-derived-overlay` and
|
||||
carries related type, interface, slot, and target observations. Generated
|
||||
|
||||
@@ -193,7 +193,11 @@ these tools before compilation. Keeping this matrix separate lets Linux
|
||||
host/provider acceptance run with only the host compiler.
|
||||
|
||||
`npm run verify:ghidra:windows` checks source-owned native x86-64 PE applications;
|
||||
`-- --x86` selects x86 and `-- --dll` selects DLLs, and the flags can be combined.
|
||||
`-- --x86`, `-- --arm`, or `-- --arm64` selects another target architecture;
|
||||
`-- --dll` selects DLLs. Choose one architecture and optionally combine it with
|
||||
`--dll`. These static fixtures contain source-owned encoded instructions; they
|
||||
are not compiler-produced programs. See the [Windows verification scope](windows-ghidra-p0.md#native-authority-and-target-identity)
|
||||
for real-provider coverage and exclusions.
|
||||
These lanes check all 26 read-only operations, target/snapshot/import SHA-256 linkage,
|
||||
and project, endpoint, process, and runtime cleanup. The independent native
|
||||
lane checks DACLs, handle admission, cancellation, and Job Object lifecycle.
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ For runtime instrumentation, see the [Frida guide](./frida-instrumentation.md).
|
||||
| Task | Guides |
|
||||
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Inspect native functions, references, or types | [Native binaries](native-investigation.md), [Go metadata](go-binaries.md), [Rust dependencies](rust-binaries.md), [offline ELF layout](binary-diagnostics.md), [recorded crashes](recorded-crashes.md) |
|
||||
| Select a native provider or import format | [Ghidra semantics](ghidra-provider.md), [Windows](windows-ghidra-p0.md), [DOS](ghidra-dos.md), [raw bytes](raw-binary.md), [MIPS](ghidra-mips.md), [PSP](ghidra-psp.md), [NativeAOT](ghidra-nativeaot.md), [IDA](ida-provider.md), [JEB](jeb-analysis.md) |
|
||||
| Select a native provider or import format | [Ghidra semantics](ghidra-provider.md), [Windows](windows-ghidra-p0.md), [DOS](ghidra-dos.md), [raw bytes](raw-binary.md), [MIPS](ghidra-mips.md), [PSP](ghidra-psp.md), [NativeAOT](ghidra-nativeaot.md), [IDA](ida-provider.md), [Kuna](kuna-provider.md), [JEB](jeb-analysis.md) |
|
||||
| Analyze JavaScript or Electron artifacts | [Static analysis](javascript-artifact-reconstruction.md), [tracing and comparisons](javascript-application-workflows.md), [application graph](javascript-application-graph.md), [source recovery](javascript-recovery.md) |
|
||||
| Compare static JavaScript with runtime observations | [Runtime attribution](javascript-runtime-observation.md), [reconciliation](javascript-runtime-reconciliation.md), [Electron observation](electron-observation.md), [Electron fuses](electron-fuses.md) |
|
||||
| Inspect assemblies, packages, or firmware | [.NET](managed-code-analysis.md), [Android](android-analysis.md), [Apktool resources](apktool-resource-analysis.md), [ADB acquisition](adb-device-analysis.md), [Apple](apple-application-analysis.md), [Harmony](harmony-analysis.md), [firmware](firmware-analysis.md), [WASM](wasm-artifacts.md), [EVM](evm-bytecode.md) |
|
||||
|
||||
+44
-12
@@ -3,13 +3,13 @@
|
||||
Run REA, connect your selected agents, and check the tools needed for your task.
|
||||
Setup previews configuration changes and asks for approval before applying them.
|
||||
|
||||
| Task | Section |
|
||||
| --------------------------------- | ------------------------------------------------------------------------- |
|
||||
| Connect an agent | [Start setup](#start-setup), then [review changes](#review-setup-changes) |
|
||||
| Diagnose one task | [Scoped readiness checks](#check-readiness-for-your-task) |
|
||||
| Configure an analysis engine | [Hopper](#hopper), [Ghidra](#ghidra), or the [IDA guide](ida-provider.md) |
|
||||
| Update or remove REA | [Maintenance](#diagnose-update-and-remove) |
|
||||
| Resolve a client-specific problem | [Client configuration](client-configuration.md) |
|
||||
| Task | Section |
|
||||
| --------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| Connect an agent | [Start setup](#start-setup), then [review changes](#review-setup-changes) |
|
||||
| Diagnose one task | [Scoped readiness checks](#check-readiness-for-your-task) |
|
||||
| Configure an analysis engine | [Hopper](#hopper), [Ghidra](#ghidra), the [IDA guide](ida-provider.md), or [Kuna](kuna-provider.md) |
|
||||
| Update or remove REA | [Maintenance](#diagnose-update-and-remove) |
|
||||
| Resolve a client-specific problem | [Client configuration](client-configuration.md) |
|
||||
|
||||
## Start setup
|
||||
|
||||
@@ -398,8 +398,9 @@ running server or its registration.
|
||||
The npm release checked on **2026-10-11** was **6.4.0**, published from
|
||||
[`a56f7bb6`](https://github.com/morluto/rea/commit/a56f7bb668ab23fec8d33f7af353ac7ed2fe1895).
|
||||
The actual registry package accepted dry-run setup plans for the 17 client IDs
|
||||
in that release, including Qwen Code, Pi and Hermes. DeepSeek Harness (`dsh`)
|
||||
is included from 6.5.0 and was absent from the checked npm 6.4.0 package.
|
||||
in that release, including Qwen Code, Pi and Hermes. Seven client IDs are
|
||||
included from 6.5.0 and were absent from the checked npm 6.4.0 package: `droid`,
|
||||
`dsh`, `kimi`, `qoder`, `trae`, `workbuddy` and `zcode`.
|
||||
The 6.4.0 registry check does not establish 6.5.0 publication or live DeepSeek
|
||||
API integration.
|
||||
OpenCode's plan selected
|
||||
@@ -482,8 +483,8 @@ hosted connector; see [its configuration](client-configuration.md#other-client-s
|
||||
| ZCode | `zcode` |
|
||||
| DeepSeek Harness | `dsh` |
|
||||
|
||||
`dsh`, `kimi`, and `workbuddy` require a release containing them. The registry
|
||||
check above does not cover them.
|
||||
`droid`, `dsh`, `kimi`, `qoder`, `trae`, `workbuddy`, and `zcode` require
|
||||
`rea-agents@6.5.0` or later. The 6.4.0 registry check above does not cover them.
|
||||
|
||||
See [client configuration and troubleshooting](client-configuration.md) for
|
||||
configuration paths, profiles, trust policies, and schema-limit workarounds.
|
||||
@@ -541,6 +542,37 @@ search permissions (`0700`) on a directory you own before retrying.
|
||||
|
||||
On supported Linux distributions, approved setup verifies Hopper's official
|
||||
`.deb`, `.rpm`, or Arch package before invoking the native package manager.
|
||||
The official release feed selects the current public demo without a version
|
||||
pin. REA verifies the package's detached PGP signature against Hopper's stable
|
||||
primary fingerprint `7C2D73BAFAF5B9A710A69DA1A26DF815099B1BCD`, then checks
|
||||
that the signed package and installed launcher agree with `main_exe_hash`.
|
||||
Rotating signing subkeys remain bound to that primary identity.
|
||||
The feed row itself is not PGP-signed; doctor labels its display version as
|
||||
`reported_release_version`, separately from the authenticated launcher identity.
|
||||
|
||||
The approval plan includes the caller-selected cache location. Approved setup
|
||||
retains the signed archive, public key and release metadata under
|
||||
`${XDG_CACHE_HOME:-$HOME/.cache}/rea/hopper-releases/<launcher-sha256>`.
|
||||
An empty `XDG_CACHE_HOME` uses `$HOME/.cache`. Approved setup can repair a
|
||||
damaged caller-owned entry after authenticating a fresh package; the previous
|
||||
entry is preserved beside it as `<launcher-sha256>.backup-<id>`. Ordinary doctor
|
||||
and launches reject damaged evidence and never repair it implicitly.
|
||||
Approved publications of the same canonical cache entry share a process-backed
|
||||
lease. Concurrent setup waits without moving another writer's evidence; a
|
||||
failed replacement restores the previous directory when possible and reports
|
||||
any retained backup path. Unavailable reads or native inspection tools do not
|
||||
authorize replacing existing evidence.
|
||||
Doctor and launches authenticate this evidence for offline use; an editable
|
||||
digest receipt alone cannot authorize a launcher. Verification reuses at most
|
||||
eight immutable package proofs per process, keyed by the complete package,
|
||||
key, signature, package format and expected launcher digest. Cached file reads
|
||||
still check identity and content. Without retained evidence, inspecting an
|
||||
existing install requires the matching current official package and network
|
||||
access. Successful live inspection can be reused within that process after
|
||||
rehashing the launcher; it does not write a persistent cache or claim that a
|
||||
previously observed release is still the latest. Older uncached builds require
|
||||
an approved update while the feed exposes only its current release.
|
||||
|
||||
REA runs the supported demo build on a private Xvfb display and selects Hopper's
|
||||
offered demo mode for each analysis session; it does not require the user's
|
||||
desktop display. Unattended package-manager access requires
|
||||
@@ -765,7 +797,7 @@ and `set_addresses_names` name a function entry or any other mapped address
|
||||
session metadata edits leave executable bytes unchanged and are discarded on close. GUI controls
|
||||
require Hopper; Windows P0 remains read-only.
|
||||
|
||||
Windows P0 admits native x86 and x86-64 PE applications and DLLs, plus explicitly
|
||||
Windows P0 admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE applications and DLLs, plus explicitly
|
||||
selected [raw NMOS 6502 images](raw-binary.md#nmos-6502) with a caller-supplied
|
||||
entry at file offset 0, on fixed local NTFS volumes. Other raw CPU families remain
|
||||
unsupported on Windows.
|
||||
|
||||
@@ -6,7 +6,7 @@ are `inspect_analysis_view`, `trace_application_feature`,
|
||||
`trace_javascript_semantics`, `compare_application_versions`,
|
||||
`compare_source_to_bundle`, and `compare_javascript_export_shapes`; their CLI
|
||||
equivalents use the same names with hyphens. `inspect_analysis_view` projects a
|
||||
summary, module page, or one module from already completed application
|
||||
summary, module page, typed module references, or one module from already completed application
|
||||
Evidence; it does not walk relationships.
|
||||
|
||||
`inspect_analysis_view` also projects retained `inspect_binary_layout`
|
||||
@@ -40,6 +40,46 @@ combine its fields with the fact's location. Semantic trace results include the
|
||||
canonical context subset referenced by their returned facts, so those facts
|
||||
remain self-contained in the response.
|
||||
|
||||
## Retained module facts
|
||||
|
||||
For canonical identities and retained source-range counts, query the existing
|
||||
`inspect_analysis_view` tool with a typed module-reference projection:
|
||||
|
||||
```json
|
||||
{
|
||||
"source": {
|
||||
"kind": "retained-evidence",
|
||||
"evidence_id": "ev_ACTUAL_PARENT_ID"
|
||||
},
|
||||
"view": {
|
||||
"kind": "javascript",
|
||||
"collection": "modules",
|
||||
"projection": "references",
|
||||
"where": { "path": "main.js", "kind": "javascript-module" },
|
||||
"offset": 0,
|
||||
"limit": 16
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Replace the parent ID with the actual analysis summary's `parent_evidence_id`.
|
||||
Filters match exact retained paths and kinds. Omission includes all values;
|
||||
`path: null` selects an unavailable path and `path: ""` selects a recorded empty
|
||||
path. Multiple identities can share a path. The default offset is 0 and limit
|
||||
is 64; follow `coverage.next_offset` for later matching rows in retained order.
|
||||
|
||||
Each row contains its `node_id`, kind, path, canonical identity, retained
|
||||
source-range observation count, and distinct supporting authority/state/confidence
|
||||
combinations in `basis`. These counts do not prove unique reference sites or
|
||||
runtime loading. Use the existing module item view with the row's `node_id` for
|
||||
exact source ranges and complete observations. The result retains parent/query
|
||||
Evidence identity, artifact identity, limitations and unknowns. `source_coverage`
|
||||
keeps selected/unselected sources, graph coverage and unknown counts separate
|
||||
from page exhaustion; an exhausted or empty page cannot prove absence from an
|
||||
incompletely analyzed application. CLI `inspect-analysis-view` reads the same
|
||||
request from a JSON file; portable input uses `source.kind: "inline"` with the
|
||||
complete parent Evidence.
|
||||
|
||||
## Feature tracing
|
||||
|
||||
Select one literal seed kind: node ID, route, string, API, IPC channel, module,
|
||||
|
||||
@@ -206,6 +206,9 @@ code unit, matching the original bytes identified by the artifact digest.
|
||||
|
||||
Plain `.ts` artifact sources use TypeScript syntax without JSX, including
|
||||
angle-bracket type assertions. `.tsx` and `.jsx` retain JSX parsing.
|
||||
JavaScript sources use JavaScript grammar with JSX, never TypeScript syntax,
|
||||
so valid JavaScript that TypeScript reads differently keeps its JavaScript
|
||||
meaning.
|
||||
|
||||
Relative TypeScript imports can name their emitted `.js`, `.mjs`, or `.cjs`
|
||||
counterparts while resolving to inventoried source files. This substitution
|
||||
@@ -220,7 +223,10 @@ Selected bounded text is then parsed as inert data to recover:
|
||||
- Webpack and Rspack chunk registrations and module factories represented as
|
||||
AST literals;
|
||||
- static imports, dynamic imports, CommonJS `require` calls, workers, and
|
||||
service workers;
|
||||
service workers (only `new Worker(new URL(path, import.meta.url))` resolves
|
||||
relative to the calling module; string worker and service-worker paths use
|
||||
the document base URL or Node's working directory, which static analysis
|
||||
does not establish, so they keep their expression and stay unresolved);
|
||||
- route, network endpoint, storage, and vendor-marker observations;
|
||||
- local source-map declarations and original
|
||||
source names and content digests;
|
||||
@@ -270,8 +276,13 @@ RPC client syntax also contributes network endpoint candidates, in both
|
||||
named operation found at the start of a string or cooked template literal —
|
||||
the name must be followed by variable definitions (`($`), a directive, or a
|
||||
selection set starting with a field name — or in a precompiled
|
||||
`OperationDefinition` document object. A graphql-tag `loc.source.body` copy is
|
||||
not reported twice. Anonymous operations are not reported.
|
||||
`OperationDefinition` document object. A standalone Source object's `body`
|
||||
remains an operation candidate even when it has `locationOffset` metadata.
|
||||
A graphql-tag `loc.source.body` copy is suppressed only when that source
|
||||
belongs to a recovered document with the same operation and its containing
|
||||
document, location and source have proven private metadata ownership. Writes,
|
||||
escapes and classic-script global bindings retain the source observation.
|
||||
Anonymous operations are not reported.
|
||||
|
||||
Literal link options and precompiled document fields follow object property
|
||||
order: the final definition owns the key. A later spread, dynamic computed key,
|
||||
@@ -626,6 +637,10 @@ href are read without surrounding whitespace or embedded tabs and newlines, and
|
||||
their percent-encoded path bytes are decoded; encoded dot and separator bytes
|
||||
are still rejected. CommonJS module lookups retain extension and directory
|
||||
resolution.
|
||||
ESM, HTML, and URL references apply URL dot segments to empty path segments:
|
||||
`./assets//../app.js` selects `assets/app.js`, while a remaining empty segment
|
||||
such as `./assets//app.js` stays unavailable. CommonJS keeps filesystem path
|
||||
semantics and selects `app.js` for the same text.
|
||||
Unresolved HTML references retain their declaration, source range, and resolution
|
||||
reason in the renderer observations.
|
||||
HTML script source ranges follow the HTML parser across LF, CRLF, and bare CR
|
||||
|
||||
@@ -95,6 +95,11 @@ pauses or resumes execution, calls `Runtime.runIfWaitingForDebugger`, launches
|
||||
the target, instruments JavaScript, or invokes Electron APIs. Closing a call
|
||||
closes only REA's WebSocket.
|
||||
|
||||
Each WebSocket handshake and command response has its own 20-second deadline,
|
||||
separate from the caller-selected observation window. A stalled handshake or
|
||||
command reports `provider_timeout` and retains observations already received;
|
||||
caller cancellation still reports cancellation.
|
||||
|
||||
The direct observations are:
|
||||
|
||||
- `Debugger.scriptParsed`, establishing that a bounded script location was
|
||||
|
||||
@@ -91,17 +91,20 @@ nodes. REA evaluates compatible static candidates conservatively:
|
||||
|
||||
1. A captured-source SHA-256 plus one matching mapped location yields
|
||||
a content-and-location match.
|
||||
2. One unique exact content digest can match even when no location mapping is
|
||||
available. Whole-asset digests and reconstructed module-factory source
|
||||
2. When no static candidate exists at a mapped location, one unique exact
|
||||
content digest can match. Whole-asset digests and reconstructed module-factory source
|
||||
digests remain distinguishable in the reported basis.
|
||||
3. Without captured bytes, one unique mapped artifact path can produce a
|
||||
medium-confidence location match.
|
||||
4. Multiple candidates remain `ambiguous`; no `observed_as` edge is emitted.
|
||||
With captured source and mapped candidates, only mapped content matches
|
||||
qualify; unrelated content matches elsewhere are excluded.
|
||||
`candidate_static_count` reports the full qualified layer/node count, and
|
||||
`candidate_static_nodes` includes every unique candidate reference.
|
||||
5. If captured bytes disagree with the static candidate at the mapped path,
|
||||
the result is an explicit mismatch. A path never overrides a digest
|
||||
disagreement.
|
||||
the result is an explicit mismatch. An equal digest elsewhere cannot hide
|
||||
that disagreement. If a mapped candidate's digest is unavailable and no
|
||||
mapped content match is known, the comparison remains `unknown`.
|
||||
6. Missing authorization mappings and incomplete or truncated input coverage
|
||||
remain unknown or truncated rather than becoming absence claims.
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
# Kuna provider
|
||||
|
||||
[Kuna](https://github.com/Noelo-Lab/kuna) is an Apache-2.0 decompiler distributed as one `kuna` executable. REA uses a `kuna` you supply. It does not download, install, update or bundle Kuna. REA verified this provider with Kuna 1.833; it accepts other releases and reports them as unverified in `rea doctor` and in each analysis profile.
|
||||
|
||||
Kuna is static: it reads the selected image and never executes it.
|
||||
|
||||
## Configure
|
||||
|
||||
```bash
|
||||
export REA_KUNA_COMMAND=/absolute/path/to/kuna
|
||||
rea doctor --provider kuna
|
||||
```
|
||||
|
||||
Select it explicitly with `--provider kuna`, MCP's `open_binary.provider_id: "kuna"`, or `REA_ANALYSIS_PROVIDER=kuna`. With Kuna and another provider configured for the same target, `auto` reports `ambiguous` instead of choosing one.
|
||||
|
||||
| Setting | Default | Meaning |
|
||||
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `REA_KUNA_COMMAND` | none (required) | Absolute path of the `kuna` executable. |
|
||||
| `REA_KUNA_CACHE_DIR` | `~/Library/Caches/rea/kuna` (macOS), `$XDG_CACHE_HOME/rea/kuna` (Linux; `~/.cache/rea/kuna` when `XDG_CACHE_HOME` is unset or relative) | Absolute directory REA owns for project exports. Kuna's own spec cache also lives here, not in your Kuna cache. |
|
||||
| `REA_KUNA_CACHE_MAX_BYTES` | 4 GiB | Size cap; least recently used exports are evicted above it. |
|
||||
| `REA_KUNA_PROJECT_TIMEOUT_MS` | 30 minutes | Deadline for whole-program inventory/export, reference and string scans. |
|
||||
| `REA_KUNA_TIMEOUT_MS` | 120 s | Deadline for one single-function decompile, and for the inventory run REA makes when the export ends without one. |
|
||||
| `REA_KUNA_JOBS` | 1 | `decompile-project --jobs`. 1 is Kuna's reference answer; more jobs finish sooner but lose callee-first prototypes, and change about 40–60% of function bodies on the measured binaries. |
|
||||
|
||||
Windows is not supported yet. Supported targets are ELF and thin Mach-O executables for x86-64, AArch64 and ARM; PE and universal Mach-O are rejected with a typed reason.
|
||||
|
||||
## What Kuna answers
|
||||
|
||||
| Tool | Source |
|
||||
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `list_procedures`, `search_procedures`, `procedure_address` | Kuna's callable inventory (`kuna functions --json`), including import slots it does not decompile |
|
||||
| `address_name` | Function entries, then the data labels Kuna's export assigns |
|
||||
| `procedure_pseudo_code`, `batch_decompile` | The project export, or a single-function run while the export builds |
|
||||
| `procedure_assembly` | The project export's labeled listing |
|
||||
| `procedure_callers`, `procedure_callees` | Call-kind edges from a lazy, body-free Kuna graph; synthetic import nodes are accepted by address |
|
||||
| `list_strings`, `search_strings` | Typed string candidates from one cached, reference-free scan; exact-address, literal and ECMAScript regex selection |
|
||||
| `xrefs` | Exact-address incoming reference sites, with forwarding aliases filtered explicitly |
|
||||
| `analyze_function` | Pseudocode and assembly from the export, plus call relationships; typed references, comments, strings and CFG remain unavailable |
|
||||
|
||||
Typed procedure references, basic blocks, raw-memory tools, annotations and type recovery are not available from this provider. Use another provider for those operations.
|
||||
|
||||
## How answers are produced
|
||||
|
||||
The first text or assembly request in a session looks for this target's export in the cache. `list_documents` reads the selected path without initializing analysis. Inventory, function lookup, string queries, call relationships and xrefs do not start a C export. A data-name lookup starts it only when the address is absent from the function inventory. The export is keyed by the target's SHA-256, the Kuna executable's SHA-256, its version and `--jobs`.
|
||||
|
||||
- **Warm cache:** analysis reads reuse the verified export. A fresh server verifies its file digests once, even for concurrent first requests; that cost scales with export size.
|
||||
- **Cold cache:**
|
||||
- REA starts `kuna decompile-project` in the background on a private copy of the target.
|
||||
- Meanwhile, pseudocode comes from one `kuna decompile --addr` run. Name and address lookups, and listings, use the inventory the export takes with `kuna functions --json` before it decompiles. The session runs `kuna functions` itself, under `REA_KUNA_TIMEOUT_MS`, only when no export is building (an inventory-only request does not start one) or the export ends without an inventory.
|
||||
- Requests for the same function share one run; it stops when its last waiting request is cancelled. Each run analyzes the whole image again in its own process, so one REA process runs at most as many at once as the host has cores beyond `REA_KUNA_JOBS` (at least one). Further requests wait in order, and a waiting request is answered from the export if it finishes first. A run whose stop REA cannot prove keeps its slot until `close_binary` proves it stopped.
|
||||
- Assembly and data names wait for the export; progress notifications report the wait every ten seconds. A session does not rebuild a failed export: requests that need it fail with `retryable: false`, the export's failure, its captured Kuna output and what to change before reopening the target. A setting such as `REA_KUNA_PROJECT_TIMEOUT_MS` or `REA_KUNA_JOBS` is read when REA starts, so changing it also needs a restart. Pseudocode keeps using single-function runs.
|
||||
- A single-function answer says so in its limitations. It lacks the export's whole-program prototypes, so a later request can return different text for the same function.
|
||||
|
||||
Pseudocode, assembly, `analyze_function` and data-name answers record where their text came from in `raw_result.source`: `single-function`, or `project-export` with the cache directory. `procedure_pseudo_code` and `procedure_assembly` answers from the export also name the file, byte span and the file's SHA-256. Combined `analyze_function` answers retain both facet records in `raw_result.source.files`, each with its file, digest and byte span. Both texts come from one export; losing that project retries the complete report. Listings and procedure lookups carry no `raw_result`. Agents can open or search the export's `.c` and `.asm` there directly when that is cheaper than calling a tool per function. Text read that way is target-derived, like any decompiler output, but it bypasses the untrusted-content marker that REA's tool results carry.
|
||||
|
||||
The background export belongs to the session. `close_binary`, or the end of a CLI command, cancels it unless another session still waits for it. A one-shot CLI decompile therefore answers from a single-function run; any request that needs the export, such as `procedure_assembly` or `analyze_function`, keeps it.
|
||||
|
||||
The assembly label index is scanned once per export reader. Cancelling a request stops its wait without interrupting other readers; closing the session aborts and drains the shared scan before releasing its files.
|
||||
|
||||
Regex procedure and string search uses ECMAScript Unicode matching in a cancellable worker with a five-second matching deadline. Literal matching remains the default. Cancellation or a matching deadline leaves the session available.
|
||||
|
||||
Single-function subprocess output and each cached source facet share a 16 MiB buffered-text capacity. Cached spans are checked before allocation; larger text remains in the local export and the error identifies the file and range. `analyze_function` initially returns the complete dossier, which can still be large; later retained views do not remove that first transfer. Prefer the individual text tools for a focused question.
|
||||
|
||||
## Strings
|
||||
|
||||
`list_strings` and `search_strings` share one lazy `kuna strings --json --encoding all --min-length 5 --termination any --no-xrefs` scan of the digest-checked private input. Skipping references avoids program lifting, a call graph and a C export. REA validates the input, scan policy, every row and the total before caching any facts. Encoding, character count, byte length and terminator facts must agree; supplementary UTF-8 characters count as Unicode scalars. Malformed or oversized output is an error, not an empty search. JSON admits at most 16 MiB before parsing. String scans use the whole-program `REA_KUNA_PROJECT_TIMEOUT_MS` deadline; `REA_KUNA_TIMEOUT_MS` applies to single-function decompilation. The parsed inventory belongs to one selected target/executable profile and expires on session close; deterministic output-buffer failures are retained until close, while other failures are not cached.
|
||||
|
||||
Results keep exact u64 virtual addresses, decoded text, native encoding, terminator status and byte length including any terminator. Kuna scans mapped sections or segments for runs of at least five characters; unterminated fragments can include instruction bytes. `all` includes ASCII, UTF-8 and the engine's Latin-range UTF-16LE reading. Other text, including short strings, non-Latin wide text and UTF-16BE, can remain undiscovered. An empty result does not prove absence.
|
||||
|
||||
Use `search_strings` for the matching rows or `list_strings` with an exact address for that location. Literal and regex matching run in REA, preserving the existing case and ECMAScript Unicode semantics instead of substituting Kuna's different regex dialect. Procedure and string regex queries share one worker slot per session. Input projections are materialized only after admission, so queued queries retain no per-query inventory arrays. Close cancels and drains matching. Native metadata queries also share one admission slot, including references; a failed stop retains admission until cleanup is proven.
|
||||
|
||||
`raw_result.strings` reports the source JSON digest/size, scanned scope, extraction policy, complete inventory count and selected count without copying unrequested text into the answer. Omit the address from `list_strings` to retrieve the complete inventory as Evidence; normal session retention and bundle export apply, including transport-capacity errors for oversized inline replies. These operations preserve their complete-result contracts and do not add paging. Function-referenced string facets in `analyze_function` remain unavailable; call `xrefs` explicitly when references to one returned string are needed.
|
||||
|
||||
## Calls and references
|
||||
|
||||
The first call query runs `kuna decompile-graph --functions ''`, admitting no C or assembly bodies. One validated graph and forward/reverse indexes serve later call queries and existing `get_call_graph` / `trace_call_path` workflows. Numeric u64 addresses are parsed from their original JSON tokens. Only `call` edges become callers/callees; jumps and data references retain their distinct meaning. Graph counts, edge endpoints and ordering are validated before any relationship is returned. A forwarding address may be an instruction inside a function, so it is retained separately and never promoted to a function node or call edge. Reported indirect calls make affected relationship coverage partial; no target is invented for them.
|
||||
|
||||
`xrefs` runs native `xrefs --to ADDRESS --json` on demand. Kuna unifies forwarding aliases and suppresses edges internal to their class; REA filters to the requested address and records the excluded-row count. Duplicate source sites appear once. An empty result cannot establish the absence of references. Addresses are explicit u64 values or exact, unambiguous procedure names; Kuna has no cursor.
|
||||
|
||||
Graph JSON admits at most 32 MiB before parsing; xref JSON at most 16 MiB. A large image can exceed the graph budget: an arm64 Firefox `XUL` (404k functions) does, while a 14 MB Sublime Text binary produced 31.8 MB. Output beyond a buffer is reported as a `memory` resource constraint with `retryable: false`, because the same target and executable produce the same output. The session remembers a graph that overflowed, so later call queries fail at once instead of repeating the whole-program walk. The graph is cached for the selected target and executable profile within one session. Xref reuse is an LRU charged by source bytes plus metadata, limited to 16 MiB and 128 entries; at most eight distinct native xref queries may be pending. Reference commands run one at a time per session and share the provider's foreground budget with single-function decompiles. An unproven process stop retains its admission slots until cleanup succeeds. Concurrent callers share work, individual cancellation releases only that waiter, and the last departing waiter cancels its producer and receives any unproven cleanup. Session close aborts and drains producers, releases parsed caches and retries any retained process/file cleanup.
|
||||
|
||||
Evidence includes only selected addresses or dossier neighbors, the producing JSON's SHA-256/byte count, coverage and relevant function facts; unrequested program-wide JSON and instruction text are omitted. Reference caches are in memory and expire on close: a fresh CLI process or MCP server rebuilds them. A first call query therefore costs a whole-program reference walk even when a C export is warm. These operations do not establish full Ghidra/IDA feature parity.
|
||||
|
||||
## Provenance and limitations
|
||||
|
||||
- Addresses and bytes are Kuna's observations of the image. Procedure entries and extents are its derivations: extents are upper bounds clipped at the next entry, and Kuna can split one function at an entry its own analysis infers. Pseudocode is its reconstruction, never original source.
|
||||
- Pseudocode and assembly are exact Kuna text; text from Kuna and from another provider is not comparable as equal or different.
|
||||
- Results are re-read rather than replayed from REA's analysis snapshots, because a cold answer can differ from the export's.
|
||||
|
||||
## Cache ownership
|
||||
|
||||
REA writes Kuna's exports only inside `REA_KUNA_CACHE_DIR`:
|
||||
|
||||
- `projects/<key>/` holds published, immutable exports with a manifest of file digests.
|
||||
- `staging/` holds builds whose processes may still be live.
|
||||
- `trash/` holds retired builds and evicted exports awaiting removal.
|
||||
- `home/` is Kuna's HOME.
|
||||
|
||||
Builds publish by one rename, so a reader sees a complete export or none. A session keeps the export it uses from eviction only within its own REA process. If another REA process sharing the cache evicts it, the session rebuilds it; meanwhile pseudocode falls back to single-function runs. A damaged or edited export is removed and rebuilt. Staging moves to `trash/` for removal only after REA proves its Kuna process stopped. Staging of a process it cannot prove stopped is never swept; REA keeps it owned, retries the stop on `close_binary`, and reports it until the stop is proven. Failed file removal also stays bound to its export and is retried by `close_binary`; closing does not report success while that cleanup remains. `rea doctor --provider kuna` reports the cache directory without creating it.
|
||||
|
||||
## Verify with a real Kuna
|
||||
|
||||
```bash
|
||||
REA_KUNA_COMMAND=/absolute/path/to/kuna npm run verify:kuna
|
||||
# Compare with Ghidra on caller-built binaries
|
||||
REA_KUNA_COMMAND=/absolute/path/to/kuna GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra \
|
||||
npm run verify:kuna -- --targets DIR --functions inflate,crc32 --compare-ghidra
|
||||
```
|
||||
|
||||
The lane compiles a small source-owned fixture with the host C compiler and verifies the MCP workflow end to end. `--targets DIR --functions a,b` adds caller-built binaries. `--compare-ghidra` (with `GHIDRA_INSTALL_DIR`) runs those same functions through Ghidra; it requires `--targets` and `--functions` and refuses empty matrices or requested function names missing from every target. See [testing](testing.md#kuna-lane) for coverage.
|
||||
|
||||
Failed runs also report process-lineage evidence and exit unsuccessfully. If provider or transport cleanup is unconfirmed, the report says `cleanup: "incomplete"` and records `retained_workspace`; that directory is preserved for investigation and cleanup retries.
|
||||
@@ -352,7 +352,7 @@ install it or its toolchain. The [NativeAOT guide](ghidra-nativeaot.md) defines
|
||||
these routes, their layout/host restrictions, derived-memory provenance, and
|
||||
verification coverage.
|
||||
|
||||
REA's experimental Windows Ghidra boundary admits native x86 and x86-64 PE
|
||||
REA's experimental Windows Ghidra boundary admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE
|
||||
applications and DLLs for static analysis. For x64 PE NativeAOT, the read-only
|
||||
parser also runs there; the [NativeAOT guide](ghidra-nativeaot.md) lists what a
|
||||
Windows host covers.
|
||||
|
||||
@@ -497,7 +497,10 @@ declared by their tools. Artifact extraction materializes the selected regular
|
||||
files into a fresh REA-chosen temporary directory and reports its path.
|
||||
|
||||
`analyze_javascript_application` reads the supplied local directory or ASAR path
|
||||
and returns its result and Evidence inline.
|
||||
and returns its result and Evidence inline. Its owned analysis worker and private
|
||||
temporary source files are declared as `launchesProcess` and `writesFilesystem`,
|
||||
including for a single JavaScript source. This internal analysis does not execute
|
||||
the supplied application code.
|
||||
|
||||
## Ghidra first-query deadlines and recovery
|
||||
|
||||
|
||||
+6
-2
@@ -111,8 +111,12 @@ list does not establish that the target has no procedures.
|
||||
Suggestions are Unicode-normalized, case-insensitive prefix matches. The server
|
||||
deduplicates them and sorts by code point for deterministic results. Procedure
|
||||
completion derives candidates from the complete inventory, so a name is offered
|
||||
only when it identifies one address in that inventory. Completion returns all
|
||||
matching values; it does not expose paging controls.
|
||||
only when it identifies one address in that inventory. A completion reply
|
||||
carries at most 100 values, the MCP limit. `total` counts every match and
|
||||
`hasMore` is `true` when values were omitted. Completion has no paging
|
||||
controls. A longer prefix reaches an omitted value only when it excludes other
|
||||
matches; matching uses normalized, case-insensitive forms, so a value can stay
|
||||
unreachable when more than 100 matches share its normalized prefix.
|
||||
|
||||
## Lifecycle and safety
|
||||
|
||||
|
||||
@@ -270,7 +270,9 @@ Mach-O image. Architecture
|
||||
`file_offset` values are container-relative. Entrypoint, segment and section
|
||||
`file_offset` values retain their source meaning and are relative to the
|
||||
selected Mach-O slice. Raw load-command fields retain their original values.
|
||||
Evidence locations map the LC_MAIN entrypoint and nonempty file-backed segment
|
||||
A field otool prints more than once, such as each `LC_BUILD_VERSION` tool, is
|
||||
keyed `name #n` in print order. Each `LC_LINKER_OPTION` string is keyed
|
||||
`string #n` and checked against the declared `count`. Evidence locations map the LC_MAIN entrypoint and nonempty file-backed segment
|
||||
ranges to container offsets by adding the observed slice offset. Zero-fill
|
||||
segments do not produce file ranges. When the selected slice's container offset
|
||||
is unknown, those mapped locations are omitted with an explicit limitation;
|
||||
@@ -378,7 +380,12 @@ complete observation.
|
||||
property: `N` means `nonatomic`; a complete typed attribute string without
|
||||
`N` means the Objective-C default `atomic`;
|
||||
missing or incomplete attribute metadata leaves `atomicity` and any
|
||||
unestablished read-only value null. `is_meta_class`, `is_root_class`, and
|
||||
unestablished read-only value null. A type attribute whose quoted class name
|
||||
never closes is incomplete and marks `objc_properties_categories` partial
|
||||
with `property_attributes_incomplete`. A property record that cannot be
|
||||
decoded, such as one with an empty or unmapped name, is reported as
|
||||
`property_decode_failed` at its entry address while sibling properties are
|
||||
retained. `is_meta_class`, `is_root_class`, and
|
||||
`ivar_count` are also nullable when the selected provider exposes only symbol
|
||||
names. Class implementation methods have null `is_required` and `is_optional`
|
||||
fields because those facts apply to protocol declarations; decoded protocol
|
||||
@@ -490,7 +497,7 @@ is present. A denied trace reports the `debugger-attach-denied` reason.
|
||||
Install a Ghidra 12.1.x release and the 64-bit full JDK it declares, then configure REA to
|
||||
use them. Ghidra analysis supports Linux x64/arm64 and macOS x64/arm64; each installation requires
|
||||
the matching native decompiler. Experimental Windows x64 P0 admits native
|
||||
x86 and x86-64 PE applications and DLLs, plus explicitly selected
|
||||
x86, x86-64, ARMNT (Thumb-2) and ARM64 PE applications and DLLs, plus explicitly selected
|
||||
[raw NMOS 6502 images](raw-binary.md#nmos-6502) with a caller-supplied load address,
|
||||
on fixed local NTFS volumes. Other raw CPU families remain unsupported on Windows.
|
||||
The boundary uses bundled Job Object ownership, protected runtime DACLs, and
|
||||
@@ -570,6 +577,12 @@ Exact and ambiguous value counts describe emitted root/object value instances;
|
||||
a root and an object may contain the same value. Archive digests identify the
|
||||
original bytes.
|
||||
|
||||
Dates are reported as `{ "$plist_type": "date", "iso8601": "<timestamp>" }`. A
|
||||
date the decoder cannot represent, such as an XML date with a year beyond 9999
|
||||
or a negative year, is reported as `{ "$plist_type": "date", "iso8601": null }`
|
||||
with a counted limitation; the rest of the plist or archive is still decoded.
|
||||
`inspect_plist` and Interface Builder decoding use the same projection.
|
||||
|
||||
## Locate a byte signature
|
||||
|
||||
Use `search_bytes` after opening a target with Ghidra to locate a known constant
|
||||
|
||||
@@ -166,7 +166,7 @@ npx rea-agents@latest setup
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
تختلف صيغ ملفات الشيفرة الأصلية والأنظمة المضيفة المدعومة باختلاف الموفّر. راجع [إعداد Hopper وGhidra](../installation.md#hopper)، و[دليل IDA](../ida-provider.md)، و[دعم Ghidra التجريبي على Windows](../windows-ghidra-p0.md). يدعم Ghidra أيضًا [تحليل DOS ذي 16 بت](../ghidra-dos.md). لاختيار الموفّر، راجع [دليل CLI](../cli.md#choose-a-provider). تحقّق من [توفر الميزات في الإصدارات](../installation.md#released-package-and-main) للميزات المضافة بعد أحدث إصدار على npm.
|
||||
تختلف صيغ ملفات الشيفرة الأصلية والأنظمة المضيفة المدعومة باختلاف الموفّر. راجع [إعداد Hopper وGhidra](../installation.md#hopper)، و[دليل IDA](../ida-provider.md)، [Kuna](../kuna-provider.md)، و[دعم Ghidra التجريبي على Windows](../windows-ghidra-p0.md). يدعم Ghidra أيضًا [تحليل DOS ذي 16 بت](../ghidra-dos.md). لاختيار الموفّر، راجع [دليل CLI](../cli.md#choose-a-provider). تحقّق من [توفر الميزات في الإصدارات](../installation.md#released-package-and-main) للميزات المضافة بعد أحدث إصدار على npm.
|
||||
|
||||
## دراسات الحالة
|
||||
|
||||
@@ -274,7 +274,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## سجل النجوم
|
||||
|
||||
🎉 **200,000 نجمة على GitHub — شكرًا لكم!**
|
||||
🎉 **250,000 نجمة على GitHub — شكرًا لكم!**
|
||||
|
||||
شكرًا لكل من يستخدم REA، ويبلّغ عن الأخطاء، ويقترح ميزات، ويختبر إصدارات البناء، ويساهم بالإصلاحات.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ Statische JavaScript- und .NET-Untersuchungen lesen die bereitgestellten Dateien
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Native Formate und unterstützte Hostsysteme unterscheiden sich je nach Provider. Siehe [Hopper- und Ghidra-Einrichtung](../installation.md#hopper), den [IDA-Leitfaden](../ida-provider.md) und die [experimentelle Ghidra-Unterstützung unter Windows](../windows-ghidra-p0.md). Ghidra unterstützt auch [16-Bit-DOS-Analyse](../ghidra-dos.md). Die Provider-Auswahl beschreibt der [CLI-Leitfaden](../cli.md#choose-a-provider). Prüfe die [Verfügbarkeit in Releases](../installation.md#released-package-and-main) für Funktionen, die seit der neuesten npm-Version hinzugekommen sind.
|
||||
Native Formate und unterstützte Hostsysteme unterscheiden sich je nach Provider. Siehe [Hopper- und Ghidra-Einrichtung](../installation.md#hopper), den [IDA-Leitfaden](../ida-provider.md), [Kuna](../kuna-provider.md) und die [experimentelle Ghidra-Unterstützung unter Windows](../windows-ghidra-p0.md). Ghidra unterstützt auch [16-Bit-DOS-Analyse](../ghidra-dos.md). Die Provider-Auswahl beschreibt der [CLI-Leitfaden](../cli.md#choose-a-provider). Prüfe die [Verfügbarkeit in Releases](../installation.md#released-package-and-main) für Funktionen, die seit der neuesten npm-Version hinzugekommen sind.
|
||||
|
||||
## Fallstudien
|
||||
|
||||
@@ -272,7 +272,7 @@ Melde Sicherheitslücken gemäß [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Sternverlauf
|
||||
|
||||
🎉 **200.000 GitHub-Sterne – vielen Dank!**
|
||||
🎉 **250.000 GitHub-Sterne – vielen Dank!**
|
||||
|
||||
Danke an alle, die REA nutzen, Fehler melden, Funktionswünsche äußern, Builds testen und Fehlerbehebungen beitragen.
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ npx rea-agents@latest setup
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Οι μορφές κώδικα μηχανής και τα υποστηριζόμενα συστήματα διαφέρουν ανά πάροχο ανάλυσης. Δες τη [ρύθμιση Hopper και Ghidra](../installation.md#hopper), τον [οδηγό IDA](../ida-provider.md) (που περιλαμβάνει προαιρετική γέφυρα MCP για κώδικα μηχανής) και την [πειραματική υποστήριξη Ghidra στα Windows](../windows-ghidra-p0.md). Το Ghidra υποστηρίζει επίσης [ανάλυση DOS 16 bit](../ghidra-dos.md). Για μεγάλα δυαδικά αρχεία, αύξησε το χρονικό όριο εκκίνησης του παρόχου με `REA_GHIDRA_STARTUP_TIMEOUT_MS` ή `REA_HOPPER_STARTUP_TIMEOUT_MS`. Για την επιλογή παρόχου, δες τον [οδηγό CLI](../cli.md#choose-a-provider). Έλεγξε τη [διαθεσιμότητα ανά έκδοση](../installation.md#released-package-and-main) για λειτουργίες που προστέθηκαν μετά την τελευταία έκδοση στο npm.
|
||||
Οι μορφές κώδικα μηχανής και τα υποστηριζόμενα συστήματα διαφέρουν ανά πάροχο ανάλυσης. Δες τη [ρύθμιση Hopper και Ghidra](../installation.md#hopper), τον [οδηγό IDA](../ida-provider.md) (που περιλαμβάνει προαιρετική γέφυρα MCP για κώδικα μηχανής), [Kuna](../kuna-provider.md) και την [πειραματική υποστήριξη Ghidra στα Windows](../windows-ghidra-p0.md). Το Ghidra υποστηρίζει επίσης [ανάλυση DOS 16 bit](../ghidra-dos.md). Για μεγάλα δυαδικά αρχεία, αύξησε το χρονικό όριο εκκίνησης του παρόχου με `REA_GHIDRA_STARTUP_TIMEOUT_MS` ή `REA_HOPPER_STARTUP_TIMEOUT_MS`. Για την επιλογή παρόχου, δες τον [οδηγό CLI](../cli.md#choose-a-provider). Έλεγξε τη [διαθεσιμότητα ανά έκδοση](../installation.md#released-package-and-main) για λειτουργίες που προστέθηκαν μετά την τελευταία έκδοση στο npm.
|
||||
|
||||
## Μελέτες περίπτωσης
|
||||
|
||||
@@ -285,7 +285,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## Ιστορικό αστεριών
|
||||
|
||||
🎉 **200.000 αστέρια στο GitHub — σας ευχαριστούμε!**
|
||||
🎉 **250.000 αστέρια στο GitHub — σας ευχαριστούμε!**
|
||||
|
||||
Ευχαριστούμε όλους όσοι χρησιμοποιούν το REA, αναφέρουν σφάλματα, ζητούν νέες λειτουργίες, δοκιμάζουν builds και συνεισφέρουν διορθώσεις.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ La inspección estática de JavaScript y .NET lee los archivos suministrados sin
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Los formatos nativos y los sistemas anfitriones compatibles varían según el proveedor. Consulta [configuración de Hopper y Ghidra](../installation.md#hopper), la [guía de IDA](../ida-provider.md) y la [compatibilidad experimental de Ghidra en Windows](../windows-ghidra-p0.md). Ghidra también admite [análisis de DOS de 16 bits](../ghidra-dos.md). Para elegir un proveedor, consulta la [guía de CLI](../cli.md#choose-a-provider). Comprueba la [disponibilidad por versión](../installation.md#released-package-and-main) de las funciones añadidas después de la última versión publicada en npm.
|
||||
Los formatos nativos y los sistemas anfitriones compatibles varían según el proveedor. Consulta [configuración de Hopper y Ghidra](../installation.md#hopper), la [guía de IDA](../ida-provider.md), [Kuna](../kuna-provider.md) y la [compatibilidad experimental de Ghidra en Windows](../windows-ghidra-p0.md). Ghidra también admite [análisis de DOS de 16 bits](../ghidra-dos.md). Para elegir un proveedor, consulta la [guía de CLI](../cli.md#choose-a-provider). Comprueba la [disponibilidad por versión](../installation.md#released-package-and-main) de las funciones añadidas después de la última versión publicada en npm.
|
||||
|
||||
## Casos prácticos
|
||||
|
||||
@@ -272,7 +272,7 @@ Informa de vulnerabilidades siguiendo [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Historial de estrellas
|
||||
|
||||
🎉 **200.000 estrellas en GitHub: ¡gracias!**
|
||||
🎉 **250.000 estrellas en GitHub: ¡gracias!**
|
||||
|
||||
Gracias a quienes usan REA, informan de errores, solicitan funciones, prueban compilaciones y contribuyen con correcciones.
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ REA به Node.js 22.x (>=22.19)، 24.x (>=24.11) یا 26+، بههمراه np
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
فرمتهای بومی و پشتیبانی سیستم میزبان بر اساس ارائهدهنده متفاوتاند. [راهاندازی Hopper و Ghidra](../installation.md#hopper)، [راهنمای IDA](../ida-provider.md) و [پشتیبانی آزمایشی Ghidra در ویندوز](../windows-ghidra-p0.md) را ببینید. Ghidra همچنین از [تحلیل DOS شانزدهبیتی](../ghidra-dos.md) پشتیبانی میکند. برای انتخاب ارائهدهنده، به [راهنمای CLI](../cli.md#choose-a-provider) مراجعه کنید. برای قابلیتهایی که پس از آخرین انتشار npm اضافه شدهاند، [وضعیت انتشار](../installation.md#released-package-and-main) را بررسی کنید.
|
||||
فرمتهای بومی و پشتیبانی سیستم میزبان بر اساس ارائهدهنده متفاوتاند. [راهاندازی Hopper و Ghidra](../installation.md#hopper)، [راهنمای IDA](../ida-provider.md)، [Kuna](../kuna-provider.md) و [پشتیبانی آزمایشی Ghidra در ویندوز](../windows-ghidra-p0.md) را ببینید. Ghidra همچنین از [تحلیل DOS شانزدهبیتی](../ghidra-dos.md) پشتیبانی میکند. برای انتخاب ارائهدهنده، به [راهنمای CLI](../cli.md#choose-a-provider) مراجعه کنید. برای قابلیتهایی که پس از آخرین انتشار npm اضافه شدهاند، [وضعیت انتشار](../installation.md#released-package-and-main) را بررسی کنید.
|
||||
|
||||
## نمونههای عملی
|
||||
|
||||
@@ -257,7 +257,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## تاریخچهٔ ستارهها
|
||||
|
||||
🎉 **۲۰۰٬۰۰۰ ستارهٔ GitHub — سپاسگزاریم!**
|
||||
🎉 **۲۵۰٬۰۰۰ ستارهٔ GitHub — سپاسگزاریم!**
|
||||
|
||||
از همهٔ کسانی که از REA استفاده میکنند، خطاها را گزارش میدهند، قابلیتهای جدید پیشنهاد میکنند، buildها را آزمایش میکنند و در بهبود پروژه مشارکت دارند سپاسگزاریم.
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ L'inspection statique JavaScript et .NET lit les fichiers fournis sans exécuter
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Les formats natifs et les hôtes pris en charge varient selon le fournisseur. Consultez [la configuration de Hopper et Ghidra](../installation.md#hopper), le [guide IDA](../ida-provider.md) et [la prise en charge expérimentale de Ghidra sous Windows](../windows-ghidra-p0.md). Ghidra prend aussi en charge [l'analyse DOS 16 bits](../ghidra-dos.md). Pour les gros binaires, augmentez son délai de démarrage avec `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Pour le choix du fournisseur, consultez le [guide CLI](../cli.md#choose-a-provider). Vérifiez la [disponibilité dans les versions publiées](../installation.md#released-package-and-main) pour les fonctionnalités ajoutées depuis la dernière version npm.
|
||||
Les formats natifs et les hôtes pris en charge varient selon le fournisseur. Consultez [la configuration de Hopper et Ghidra](../installation.md#hopper), le [guide IDA](../ida-provider.md), [Kuna](../kuna-provider.md) et [la prise en charge expérimentale de Ghidra sous Windows](../windows-ghidra-p0.md). Ghidra prend aussi en charge [l'analyse DOS 16 bits](../ghidra-dos.md). Pour les gros binaires, augmentez son délai de démarrage avec `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Pour le choix du fournisseur, consultez le [guide CLI](../cli.md#choose-a-provider). Vérifiez la [disponibilité dans les versions publiées](../installation.md#released-package-and-main) pour les fonctionnalités ajoutées depuis la dernière version npm.
|
||||
|
||||
## Études de cas
|
||||
|
||||
@@ -276,7 +276,7 @@ Signalez les vulnérabilités via [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Historique des étoiles
|
||||
|
||||
🎉 **200 000 étoiles GitHub — merci !**
|
||||
🎉 **250 000 étoiles GitHub — merci !**
|
||||
|
||||
Merci à toutes les personnes qui utilisent REA, signalent des bugs, proposent des fonctionnalités, testent les builds et contribuent des correctifs.
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ Pemeriksaan JavaScript dan .NET statis membaca berkas yang disediakan tanpa menj
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Format native dan dukungan sistem host berbeda-beda menurut penyedia. Lihat [penyiapan Hopper dan Ghidra](../installation.md#hopper), [panduan IDA](../ida-provider.md), dan [dukungan eksperimental Ghidra di Windows](../windows-ghidra-p0.md).
|
||||
Format native dan dukungan sistem host berbeda-beda menurut penyedia. Lihat [penyiapan Hopper dan Ghidra](../installation.md#hopper), [panduan IDA](../ida-provider.md), [Kuna](../kuna-provider.md), dan [dukungan eksperimental Ghidra di Windows](../windows-ghidra-p0.md).
|
||||
|
||||
Ghidra juga mendukung [analisis DOS 16-bit](../ghidra-dos.md).
|
||||
|
||||
@@ -297,7 +297,7 @@ Laporkan kerentanan melalui [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Riwayat Bintang
|
||||
|
||||
🎉 **200.000 bintang GitHub, terima kasih!**
|
||||
🎉 **250.000 bintang GitHub, terima kasih!**
|
||||
|
||||
Terima kasih kepada semua orang yang menggunakan REA, melaporkan bug, meminta fitur, menguji build, dan berkontribusi dalam perbaikan.
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ L'ispezione statica di JavaScript e .NET legge i file forniti senza eseguire l'a
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
I formati nativi e il supporto host variano in base al provider. Vedi la [configurazione di Hopper e Ghidra](../installation.md#hopper), la [guida IDA](../ida-provider.md) e il [supporto sperimentale Windows Ghidra](../windows-ghidra-p0.md). Ghidra supporta anche l'[analisi DOS a 16 bit](../ghidra-dos.md). Per binari di grandi dimensioni, aumenta il timeout di avvio con `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Per la selezione del provider, vedi la [guida CLI](../cli.md#choose-a-provider). Controlla la [disponibilità delle release](../installation.md#released-package-and-main) per le funzionalità aggiunte dall'ultima release npm.
|
||||
I formati nativi e il supporto host variano in base al provider. Vedi la [configurazione di Hopper e Ghidra](../installation.md#hopper), la [guida IDA](../ida-provider.md), [Kuna](../kuna-provider.md) e il [supporto sperimentale Windows Ghidra](../windows-ghidra-p0.md). Ghidra supporta anche l'[analisi DOS a 16 bit](../ghidra-dos.md). Per binari di grandi dimensioni, aumenta il timeout di avvio con `REA_GHIDRA_STARTUP_TIMEOUT_MS`. Per la selezione del provider, vedi la [guida CLI](../cli.md#choose-a-provider). Controlla la [disponibilità delle release](../installation.md#released-package-and-main) per le funzionalità aggiunte dall'ultima release npm.
|
||||
|
||||
## Showcase
|
||||
|
||||
@@ -276,7 +276,7 @@ Segnala vulnerabilità tramite [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Cronologia delle stelle
|
||||
|
||||
🎉 **200.000 stelle su GitHub — grazie!**
|
||||
🎉 **250.000 stelle su GitHub — grazie!**
|
||||
|
||||
Grazie a tutti coloro che usano REA, segnalano bug, propongono funzionalità, testano le build e contribuiscono con correzioni.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ REA には Node.js 22.x(>=22.19)、24.x(>=24.11)、または 26+ と npm
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
対応するネイティブ形式とホストは、プロバイダーによって異なります。[Hopper と Ghidra のセットアップ](../installation.md#hopper)、[IDA ガイド](../ida-provider.md)、[Windows 向け Ghidra の実験的対応](../windows-ghidra-p0.md)を参照してください。Ghidra は [16 ビット DOS 分析](../ghidra-dos.md)にも対応しています。プロバイダーの選択は [CLI ガイド](../cli.md#choose-a-provider)を参照してください。最新の npm リリース以降に追加された機能については、[リリースでの利用可否](../installation.md#released-package-and-main)を確認してください。
|
||||
対応するネイティブ形式とホストは、プロバイダーによって異なります。[Hopper と Ghidra のセットアップ](../installation.md#hopper)、[IDA ガイド](../ida-provider.md)、[Kuna](../kuna-provider.md)、[Windows 向け Ghidra の実験的対応](../windows-ghidra-p0.md)を参照してください。Ghidra は [16 ビット DOS 分析](../ghidra-dos.md)にも対応しています。プロバイダーの選択は [CLI ガイド](../cli.md#choose-a-provider)を参照してください。最新の npm リリース以降に追加された機能については、[リリースでの利用可否](../installation.md#released-package-and-main)を確認してください。
|
||||
|
||||
## 事例
|
||||
|
||||
@@ -274,7 +274,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## スター履歴
|
||||
|
||||
🎉 **GitHub スター 200,000 件、ありがとうございます!**
|
||||
🎉 **GitHub スター 250,000 件、ありがとうございます!**
|
||||
|
||||
REA の利用、バグ報告、機能の要望、ビルドのテスト、修正への貢献に感謝します。
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ REA에는 Node.js 22.x(>=22.19), 24.x(>=24.11) 또는 26+와 npm이 필요합니
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
지원하는 네이티브 형식과 호스트는 제공자마다 다릅니다. [Hopper 및 Ghidra 설정](../installation.md#hopper), [IDA 가이드](../ida-provider.md)(선택 사항인 네이티브 MCP 브리지 포함), [실험적 Windows Ghidra 지원](../windows-ghidra-p0.md)을 참고하세요. Ghidra는 [16비트 DOS 분석](../ghidra-dos.md)도 지원합니다. 큰 바이너리를 분석할 때는 `REA_GHIDRA_STARTUP_TIMEOUT_MS` 또는 `REA_HOPPER_STARTUP_TIMEOUT_MS`로 제공자의 시작 제한 시간을 늘리세요. 제공자 선택은 [CLI 가이드](../cli.md#choose-a-provider)를 참고하세요. 최신 npm 릴리스 이후 추가된 기능은 [릴리스에서의 사용 가능 여부](../installation.md#released-package-and-main)를 확인하세요.
|
||||
지원하는 네이티브 형식과 호스트는 제공자마다 다릅니다. [Hopper 및 Ghidra 설정](../installation.md#hopper), [IDA 가이드](../ida-provider.md)(선택 사항인 네이티브 MCP 브리지 포함), [Kuna](../kuna-provider.md), [실험적 Windows Ghidra 지원](../windows-ghidra-p0.md)을 참고하세요. Ghidra는 [16비트 DOS 분석](../ghidra-dos.md)도 지원합니다. 큰 바이너리를 분석할 때는 `REA_GHIDRA_STARTUP_TIMEOUT_MS` 또는 `REA_HOPPER_STARTUP_TIMEOUT_MS`로 제공자의 시작 제한 시간을 늘리세요. 제공자 선택은 [CLI 가이드](../cli.md#choose-a-provider)를 참고하세요. 최신 npm 릴리스 이후 추가된 기능은 [릴리스에서의 사용 가능 여부](../installation.md#released-package-and-main)를 확인하세요.
|
||||
|
||||
## 사례
|
||||
|
||||
@@ -283,7 +283,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## 스타 기록
|
||||
|
||||
🎉 **GitHub 스타 200,000개, 감사합니다!**
|
||||
🎉 **GitHub 스타 250,000개, 감사합니다!**
|
||||
|
||||
REA를 사용하고, 버그를 보고하고, 기능을 요청하고, 빌드를 테스트하고, 수정에 기여해 주신 모든 분께 감사드립니다.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ Statyczna analiza JavaScript i .NET odczytuje dostarczone pliki bez uruchamiania
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Obsługiwane formaty natywne i platformy zależą od dostawcy analizy. Zobacz [konfigurację Hoppera i Ghidry](../installation.md#hopper), [przewodnik IDA](../ida-provider.md) oraz [eksperymentalną obsługę Ghidry w systemie Windows](../windows-ghidra-p0.md). Ghidra obsługuje też [analizę 16-bitowego DOS-a](../ghidra-dos.md). Wybór dostawcy opisuje [przewodnik CLI](../cli.md#choose-a-provider). Sprawdź [dostępność w wydaniach](../installation.md#released-package-and-main) dla funkcji dodanych po najnowszym wydaniu npm.
|
||||
Obsługiwane formaty natywne i platformy zależą od dostawcy analizy. Zobacz [konfigurację Hoppera i Ghidry](../installation.md#hopper), [przewodnik IDA](../ida-provider.md), [Kuna](../kuna-provider.md) oraz [eksperymentalną obsługę Ghidry w systemie Windows](../windows-ghidra-p0.md). Ghidra obsługuje też [analizę 16-bitowego DOS-a](../ghidra-dos.md). Wybór dostawcy opisuje [przewodnik CLI](../cli.md#choose-a-provider). Sprawdź [dostępność w wydaniach](../installation.md#released-package-and-main) dla funkcji dodanych po najnowszym wydaniu npm.
|
||||
|
||||
## Przykłady zastosowań
|
||||
|
||||
@@ -272,7 +272,7 @@ Zgłaszaj podatności zgodnie z [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Historia gwiazdek
|
||||
|
||||
🎉 **200 000 gwiazdek na GitHubie — dziękujemy!**
|
||||
🎉 **250 000 gwiazdek na GitHubie — dziękujemy!**
|
||||
|
||||
Dziękujemy wszystkim, którzy używają REA, zgłaszają błędy, proponują nowe funkcje, testują kompilacje i przesyłają poprawki.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ A inspeção estática de JavaScript e .NET lê os arquivos fornecidos sem execu
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Os formatos nativos e os sistemas anfitriões compatíveis variam por provedor. Consulte [configuração do Hopper e Ghidra](../installation.md#hopper), o [guia do IDA](../ida-provider.md) e o [suporte experimental ao Ghidra no Windows](../windows-ghidra-p0.md). O Ghidra também oferece [análise de DOS de 16 bits](../ghidra-dos.md). Para selecionar um provedor, consulte o [guia da CLI](../cli.md#choose-a-provider). Verifique a [disponibilidade nas versões](../installation.md#released-package-and-main) das funcionalidades adicionadas após a versão mais recente no npm.
|
||||
Os formatos nativos e os sistemas anfitriões compatíveis variam por provedor. Consulte [configuração do Hopper e Ghidra](../installation.md#hopper), o [guia do IDA](../ida-provider.md), [Kuna](../kuna-provider.md) e o [suporte experimental ao Ghidra no Windows](../windows-ghidra-p0.md). O Ghidra também oferece [análise de DOS de 16 bits](../ghidra-dos.md). Para selecionar um provedor, consulte o [guia da CLI](../cli.md#choose-a-provider). Verifique a [disponibilidade nas versões](../installation.md#released-package-and-main) das funcionalidades adicionadas após a versão mais recente no npm.
|
||||
|
||||
## Casos de uso
|
||||
|
||||
@@ -272,7 +272,7 @@ Relate vulnerabilidades conforme [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Histórico de estrelas
|
||||
|
||||
🎉 **200.000 estrelas no GitHub — muito obrigado!**
|
||||
🎉 **250.000 estrelas no GitHub — muito obrigado!**
|
||||
|
||||
Obrigado a todos que usam o REA, relatam bugs, sugerem funcionalidades, testam builds e contribuem com correções.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ REA требует Node.js 22.x (>=22.19), 24.x (>=24.11) или 26+, а так
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Нативные форматы и поддерживаемые системы различаются у разных провайдеров. См. [настройку Hopper и Ghidra](../installation.md#hopper), [руководство по IDA](../ida-provider.md) и [экспериментальную поддержку Ghidra в Windows](../windows-ghidra-p0.md). Ghidra также поддерживает [анализ 16-битного DOS](../ghidra-dos.md). Выбор провайдера описан в [руководстве по CLI](../cli.md#choose-a-provider). Для функций, добавленных после последней версии в npm, проверьте [доступность в релизах](../installation.md#released-package-and-main).
|
||||
Нативные форматы и поддерживаемые системы различаются у разных провайдеров. См. [настройку Hopper и Ghidra](../installation.md#hopper), [руководство по IDA](../ida-provider.md), [Kuna](../kuna-provider.md) и [экспериментальную поддержку Ghidra в Windows](../windows-ghidra-p0.md). Ghidra также поддерживает [анализ 16-битного DOS](../ghidra-dos.md). Выбор провайдера описан в [руководстве по CLI](../cli.md#choose-a-provider). Для функций, добавленных после последней версии в npm, проверьте [доступность в релизах](../installation.md#released-package-and-main).
|
||||
|
||||
## Примеры
|
||||
|
||||
@@ -272,7 +272,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## История звёзд
|
||||
|
||||
🎉 **200 000 звёзд на GitHub — спасибо!**
|
||||
🎉 **250 000 звёзд на GitHub — спасибо!**
|
||||
|
||||
Спасибо всем, кто использует REA, сообщает об ошибках, предлагает новые функции, тестирует сборки и помогает с исправлениями.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ REA ต้องใช้ Node.js 22.x (>=22.19), 24.x (>=24.11) หรือ 26
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
รูปแบบไบนารีเนทีฟและแพลตฟอร์มที่รองรับแตกต่างกันตามผู้ให้บริการวิเคราะห์ ดู[การตั้งค่า Hopper และ Ghidra](../installation.md#hopper), [คู่มือ IDA](../ida-provider.md) และ[การรองรับ Ghidra บน Windows แบบทดลอง](../windows-ghidra-p0.md) Ghidra ยังรองรับ[การวิเคราะห์ DOS แบบ 16 บิต](../ghidra-dos.md) สำหรับการเลือกผู้ให้บริการ ดู[คู่มือ CLI](../cli.md#choose-a-provider) ตรวจสอบ[ความพร้อมใช้งานในแต่ละรุ่น](../installation.md#released-package-and-main) สำหรับฟีเจอร์ที่เพิ่มหลังรุ่นล่าสุดบน npm
|
||||
รูปแบบไบนารีเนทีฟและแพลตฟอร์มที่รองรับแตกต่างกันตามผู้ให้บริการวิเคราะห์ ดู[การตั้งค่า Hopper และ Ghidra](../installation.md#hopper), [คู่มือ IDA](../ida-provider.md) [Kuna](../kuna-provider.md) และ[การรองรับ Ghidra บน Windows แบบทดลอง](../windows-ghidra-p0.md) Ghidra ยังรองรับ[การวิเคราะห์ DOS แบบ 16 บิต](../ghidra-dos.md) สำหรับการเลือกผู้ให้บริการ ดู[คู่มือ CLI](../cli.md#choose-a-provider) ตรวจสอบ[ความพร้อมใช้งานในแต่ละรุ่น](../installation.md#released-package-and-main) สำหรับฟีเจอร์ที่เพิ่มหลังรุ่นล่าสุดบน npm
|
||||
|
||||
## ตัวอย่างการใช้งาน
|
||||
|
||||
@@ -272,7 +272,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## ประวัติดาว
|
||||
|
||||
🎉 **200,000 ดาวบน GitHub — ขอบคุณทุกคน!**
|
||||
🎉 **250,000 ดาวบน GitHub — ขอบคุณทุกคน!**
|
||||
|
||||
ขอบคุณทุกคนที่ใช้ REA รายงานบั๊ก เสนอฟีเจอร์ ทดสอบบิลด์ และช่วยแก้ไข
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ Statik JavaScript ve .NET incelemesi, uygulamayı çalıştırmadan sağlanan do
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Yerel makine kodu içeren ikili dosya biçimleri ve ana bilgisayar desteği sağlayıcıya göre değişir. [Hopper ve Ghidra kurulumu](../installation.md#hopper), isteğe bağlı native MCP bridge'i de açıklayan [IDA rehberi](../ida-provider.md) ve [Windows için deneysel Ghidra desteği](../windows-ghidra-p0.md) belgelerine bakın. Ghidra ayrıca [16 bit DOS analizini](../ghidra-dos.md) destekler. Büyük ikili dosyalar için sağlayıcının başlatma zaman aşımını `REA_GHIDRA_STARTUP_TIMEOUT_MS` veya `REA_HOPPER_STARTUP_TIMEOUT_MS` ile artırın. Sağlayıcı seçimi için [CLI rehberine](../cli.md#choose-a-provider) bakın. En son npm sürümünden sonra eklenen özellikler için [sürümlerde kullanılabilirliği](../installation.md#released-package-and-main) kontrol edin.
|
||||
Yerel makine kodu içeren ikili dosya biçimleri ve ana bilgisayar desteği sağlayıcıya göre değişir. [Hopper ve Ghidra kurulumu](../installation.md#hopper), isteğe bağlı native MCP bridge'i de açıklayan [IDA rehberi](../ida-provider.md), [Kuna](../kuna-provider.md) ve [Windows için deneysel Ghidra desteği](../windows-ghidra-p0.md) belgelerine bakın. Ghidra ayrıca [16 bit DOS analizini](../ghidra-dos.md) destekler. Büyük ikili dosyalar için sağlayıcının başlatma zaman aşımını `REA_GHIDRA_STARTUP_TIMEOUT_MS` veya `REA_HOPPER_STARTUP_TIMEOUT_MS` ile artırın. Sağlayıcı seçimi için [CLI rehberine](../cli.md#choose-a-provider) bakın. En son npm sürümünden sonra eklenen özellikler için [sürümlerde kullanılabilirliği](../installation.md#released-package-and-main) kontrol edin.
|
||||
|
||||
## Örnek çalışmalar
|
||||
|
||||
@@ -277,7 +277,7 @@ Güvenlik açıklarını [SECURITY.md](../../SECURITY.md) üzerinden bildirin.
|
||||
|
||||
## Yıldız geçmişi
|
||||
|
||||
🎉 **GitHub'da 200.000 yıldız — teşekkürler!**
|
||||
🎉 **GitHub'da 250.000 yıldız — teşekkürler!**
|
||||
|
||||
REA'yı kullanan, hata bildiren, özellik talep eden, derlemeleri test eden ve düzeltmelere katkıda bulunan herkese teşekkürler.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ REA потребує Node.js 22.x (>=22.19), 24.x (>=24.11) або 26+, а та
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Нативні формати й підтримка систем відрізняються залежно від провайдера. Дивіться [налаштування Hopper і Ghidra](../installation.md#hopper), [посібник IDA](../ida-provider.md) та [експериментальну підтримку Ghidra у Windows](../windows-ghidra-p0.md). Ghidra також підтримує [аналіз 16-бітного DOS](../ghidra-dos.md). Для вибору провайдера дивіться [посібник CLI](../cli.md#choose-a-provider). Для функцій, доданих після найновішої версії в npm, перевірте [доступність у випусках](../installation.md#released-package-and-main).
|
||||
Нативні формати й підтримка систем відрізняються залежно від провайдера. Дивіться [налаштування Hopper і Ghidra](../installation.md#hopper), [посібник IDA](../ida-provider.md), [Kuna](../kuna-provider.md) та [експериментальну підтримку Ghidra у Windows](../windows-ghidra-p0.md). Ghidra також підтримує [аналіз 16-бітного DOS](../ghidra-dos.md). Для вибору провайдера дивіться [посібник CLI](../cli.md#choose-a-provider). Для функцій, доданих після найновішої версії в npm, перевірте [доступність у випусках](../installation.md#released-package-and-main).
|
||||
|
||||
## Приклади
|
||||
|
||||
@@ -272,7 +272,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## Історія зірок
|
||||
|
||||
🎉 **200 000 зірок на GitHub — дякуємо!**
|
||||
🎉 **250 000 зірок на GitHub — дякуємо!**
|
||||
|
||||
Дякуємо всім, хто використовує REA, повідомляє про помилки, пропонує нові функції, тестує збірки й допомагає з виправленнями.
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ Kiểm tra tĩnh JavaScript và .NET đọc các tệp được cung cấp mà k
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
Định dạng mã máy và nền tảng chạy REA được hỗ trợ khác nhau tùy trình phân tích. Xem [thiết lập Hopper và Ghidra](../installation.md#hopper), [hướng dẫn IDA](../ida-provider.md) và [hỗ trợ Ghidra thử nghiệm trên Windows](../windows-ghidra-p0.md). Ghidra cũng hỗ trợ [phân tích DOS 16 bit](../ghidra-dos.md). Để chọn trình phân tích, xem [hướng dẫn CLI](../cli.md#choose-a-provider). Kiểm tra [khả năng sử dụng theo bản phát hành](../installation.md#released-package-and-main) đối với tính năng được bổ sung sau phiên bản npm mới nhất.
|
||||
Định dạng mã máy và nền tảng chạy REA được hỗ trợ khác nhau tùy trình phân tích. Xem [thiết lập Hopper và Ghidra](../installation.md#hopper), [hướng dẫn IDA](../ida-provider.md), [Kuna](../kuna-provider.md) và [hỗ trợ Ghidra thử nghiệm trên Windows](../windows-ghidra-p0.md). Ghidra cũng hỗ trợ [phân tích DOS 16 bit](../ghidra-dos.md). Để chọn trình phân tích, xem [hướng dẫn CLI](../cli.md#choose-a-provider). Kiểm tra [khả năng sử dụng theo bản phát hành](../installation.md#released-package-and-main) đối với tính năng được bổ sung sau phiên bản npm mới nhất.
|
||||
|
||||
## Các nghiên cứu điển hình
|
||||
|
||||
@@ -272,7 +272,7 @@ Báo cáo lỗ hổng theo [SECURITY.md](../../SECURITY.md).
|
||||
|
||||
## Lịch sử sao
|
||||
|
||||
🎉 **200.000 sao trên GitHub — xin cảm ơn!**
|
||||
🎉 **250.000 sao trên GitHub — xin cảm ơn!**
|
||||
|
||||
Cảm ơn mọi người đã sử dụng REA, báo lỗi, đề xuất tính năng, kiểm thử bản dựng và đóng góp bản sửa lỗi.
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ REA 需要 Node.js 22.x(>=22.19)、24.x(>=24.11)或 26+,以及 npm。
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
不同提供者支援的原生格式和主機系統有所不同。請參閱 [Hopper 與 Ghidra 設定](../installation.md#hopper)、[IDA 指南](../ida-provider.md)和[實驗性 Windows Ghidra 支援](../windows-ghidra-p0.md)。Ghidra 也支援 [16 位 DOS 分析](../ghidra-dos.md)。提供者選擇見 [CLI 指南](../cli.md#choose-a-provider)。對於最新 npm 版本發佈後新增的功能,請查看[發佈可用性](../installation.md#released-package-and-main)。
|
||||
不同提供者支援的原生格式和主機系統有所不同。請參閱 [Hopper 與 Ghidra 設定](../installation.md#hopper)、[IDA 指南](../ida-provider.md)、[Kuna](../kuna-provider.md)和[實驗性 Windows Ghidra 支援](../windows-ghidra-p0.md)。Ghidra 也支援 [16 位 DOS 分析](../ghidra-dos.md)。提供者選擇見 [CLI 指南](../cli.md#choose-a-provider)。對於最新 npm 版本發佈後新增的功能,請查看[發佈可用性](../installation.md#released-package-and-main)。
|
||||
|
||||
## 案例
|
||||
|
||||
@@ -278,7 +278,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## Star 歷史
|
||||
|
||||
🎉 **GitHub Star 達到 200,000 個,感謝大家!**
|
||||
🎉 **GitHub Star 達到 250,000 個,感謝大家!**
|
||||
|
||||
感謝每一位使用 REA、報告錯誤、提出功能需求、測試建置和貢獻修復的朋友。
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ REA 需要 Node.js 22.x(>=22.19)、24.x(>=24.11)或 26+,以及 npm。
|
||||
|
||||
<a id="choosing-a-deep-analysis-provider"></a>
|
||||
|
||||
不同提供方支持的原生格式和主机系统有所不同。请参阅 [Hopper 与 Ghidra 设置](../installation.md#hopper)、[IDA 指南](../ida-provider.md)和[实验性 Windows Ghidra 支持](../windows-ghidra-p0.md)。Ghidra 也支持 [16 位 DOS 分析](../ghidra-dos.md)。提供方选择见 [CLI 指南](../cli.md#choose-a-provider)。对于最新 npm 版本发布后新增的功能,请查看[发布可用性](../installation.md#released-package-and-main)。
|
||||
不同提供方支持的原生格式和主机系统有所不同。请参阅 [Hopper 与 Ghidra 设置](../installation.md#hopper)、[IDA 指南](../ida-provider.md)、[Kuna](../kuna-provider.md)和[实验性 Windows Ghidra 支持](../windows-ghidra-p0.md)。Ghidra 也支持 [16 位 DOS 分析](../ghidra-dos.md)。提供方选择见 [CLI 指南](../cli.md#choose-a-provider)。对于最新 npm 版本发布后新增的功能,请查看[发布可用性](../installation.md#released-package-and-main)。
|
||||
|
||||
## 案例
|
||||
|
||||
@@ -278,7 +278,7 @@ npx rea-agents@latest setup
|
||||
|
||||
## Star 历史
|
||||
|
||||
🎉 **GitHub Star 达到 200,000 个,感谢大家!**
|
||||
🎉 **GitHub Star 达到 250,000 个,感谢大家!**
|
||||
|
||||
感谢每一位使用 REA、报告错误、提出功能需求、测试构建和贡献修复的朋友。
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# Reconstruction coverage
|
||||
|
||||
`rea evaluate-reconstruction-coverage coverage.json --json` evaluates an inline
|
||||
coverage workspace and its selected `boundary_id`. MCP exposes the same input
|
||||
through `evaluate_reconstruction_coverage`. Results contain a status, reasons,
|
||||
recommended probes and Evidence references; the supplied bundle retains the
|
||||
complete records.
|
||||
|
||||
Evidence IDs and bundle manifests must authenticate before evaluation. A valid
|
||||
record can still be insufficient proof: a passing verifier summary cannot
|
||||
promote inferred Evidence into a replay observation. That case returns
|
||||
`unknown`, while a missing or tampered record remains an input error.
|
||||
|
||||
## Comparable verifier Evidence
|
||||
|
||||
At least one record explicitly cited by the latest verifier observation must
|
||||
support the declared contract authority:
|
||||
|
||||
| Contract authority | Evidence source | Confidence |
|
||||
| ------------------- | ----------------------------------------- | ----------------------- |
|
||||
| `shipped-artifact` | `shipped-artifact` | `observed` or `derived` |
|
||||
| `controlled-replay` | `controlled-replay` | `observed` |
|
||||
| `live-observation` | `controlled-replay` or `external-service` | `observed` |
|
||||
| `external` | `external-service` | `observed` |
|
||||
|
||||
Contextual references can accompany qualifying proof. An unrelated observed
|
||||
record elsewhere in the bundle cannot repair a result that cites only
|
||||
inference. Older observed results cannot replace the newest weak result.
|
||||
Equivalent observations at the same instant can share qualifying proof from
|
||||
one of those observations; conflicting tied assessments remain unknown.
|
||||
|
||||
## Package and integration proof
|
||||
|
||||
Build, clean-install and runtime-routing claims require observed runtime
|
||||
Evidence (`controlled-replay` or `external-service`). Package-content and
|
||||
authority-independence audits can also use observed or derived
|
||||
`shipped-artifact` Evidence. Each proof must cite its qualifying records and
|
||||
cover the selected boundary's artifact digests. An inference alone establishes
|
||||
neither a passing nor a failed package workflow.
|
||||
|
||||
The evaluator preserves Evidence provenance and returns an actionable unknown
|
||||
when qualification is unavailable. It does not change the cited records to
|
||||
make their authority match a caller's declaration.
|
||||
@@ -323,3 +323,6 @@ disposition but does not silently count it as verified.
|
||||
The tool returns every obligation inline. Its `ledger_id` and `closure_digest`
|
||||
identify the complete result, including summaries, reports, ownership and
|
||||
dependency graphs, Evidence links, and limitations.
|
||||
|
||||
For named boundaries with explicit verifier contracts and package-proof kinds,
|
||||
see [reconstruction coverage](reconstruction-coverage.md).
|
||||
@@ -16,11 +16,12 @@ can run.
|
||||
|
||||
`inspect_with_objdump` and `rea inspect-with-objdump` capture stdout and stderr as inline Evidence. Artifact inspection Evidence records SHA-256 digests before and after the provider call and whether those observed digests differ; this cannot prove the exact bytes consumed if the artifact changes during execution. Choose one artifact operation: `file_headers`, `section_headers`, `symbols`, `relocations`, `dwarf`, `disassemble`, or `disassemble_all`. `disassemble` maps to `-d`; `disassemble_all` maps to `-D` and has different symbol-boundary semantics. The pathless `inspect_with_objdump {"operation":"architectures"}` MCP call or `rea list-objdump-architectures` CLI command maps to `-i` and produces subjectless provider-capability Evidence describing BFD targets compiled into the installed binary, not a guarantee that a target is supported.
|
||||
|
||||
For DWARF, REA does not follow local debug links by default. Set `follow_debug_links` to `true` to pass `-WK`; external debug-file identities are not bound to Evidence when following links is enabled. The CLI option is `--follow-debug-links true`. REA clears `DEBUGINFOD_URLS` in the objdump child environment to disable debuginfod network access on GNU binutils versions that do not support `-WE`. The complete raw output is authoritative; REA does not normalize it into a version-independent disassembly schema.
|
||||
For DWARF, REA does not follow local debug links by default. Set `follow_debug_links` to `true` to pass `-WK`; external debug-file identities are not bound to Evidence when following links is enabled. The CLI flag is `--follow-debug-links`; `--no-follow-debug-links` or `--follow-debug-links=false` keeps the default. A separate `true` or `false` word after the flag is not its value. REA clears `DEBUGINFOD_URLS` in the objdump child environment to disable debuginfod network access on GNU binutils versions that do not support `-WE`. The complete raw output is authoritative; REA does not normalize it into a version-independent disassembly schema.
|
||||
|
||||
```sh
|
||||
rea inspect-with-objdump ./program disassemble
|
||||
rea inspect-with-objdump ./program dwarf --follow-debug-links false
|
||||
rea inspect-with-objdump ./program dwarf
|
||||
rea inspect-with-objdump ./program dwarf --follow-debug-links
|
||||
```
|
||||
|
||||
Captured stdout and stderr are retained up to a 16 MiB combined limit; `output_truncated` marks output beyond that limit.
|
||||
|
||||
@@ -817,6 +817,38 @@ Native IDA MCP verification uses `"protocol": "native"` with an already-running
|
||||
|
||||
The initial Linux x64 IDA Free 9.4 run used native MCP 1.1.2 with a local navigation correction. Windows x64 verification uses **IDA Pro 9.3**, the two-function public fixture, and the shipped Windows `whoami.exe` application. The native plugin was built from upstream `c9d15d98e8a143fc74f6e14037c48f63889b6d6c`, including the merged navigation fix, with a local loopback-listener change. Production CLI/MCP parity, switching, identity and cleanup passed. Correctness and performance measurements are recorded in the [Windows native verification notes](https://github.com/morluto/rea/blob/main/experiments/analysis-efficiency/ida-native-windows.md). Stock 1.1.2 switching, native macOS, and Windows IDA Free remain unverified. See the [native bridge prerequisites](ida-provider.md#optional-native-ida-mcp-bridge).
|
||||
|
||||
## Kuna lane
|
||||
|
||||
`npm run verify:kuna` requires a caller-supplied `kuna` in `REA_KUNA_COMMAND`
|
||||
and a host C compiler (`REA_CC`, default `cc`) with `strip` and `nm`. It builds a
|
||||
source-owned fixture with non-inlined calls, with symbols and stripped, then verifies through MCP that
|
||||
callers, callees and exact incoming xrefs agree with those calls, graph/path
|
||||
composition reaches the callee, reference-only queries leave project/staging
|
||||
entries unchanged, repeated relationships reuse the graph, and
|
||||
the first cold pseudocode answer comes from a single-function run or an export
|
||||
that already finished, assembly waits for and serves from that export, and
|
||||
pseudocode and both dossier facets match their recorded file spans and digests,
|
||||
a fresh server reuses the export without rebuilding it, staging is empty after
|
||||
a completed export, and no owned process survives. Pass
|
||||
`--targets DIR --functions a,b` to add caller-built binaries laid out as
|
||||
`DIR/<flavor>/<name>` beside `<name>.stripped`; addresses come from the
|
||||
symbol-bearing build. `--compare-ghidra` with `GHIDRA_INSTALL_DIR` runs those
|
||||
caller-built functions through Ghidra (it refuses to run without `--targets` and
|
||||
`--functions`, an empty matrix, or names missing from every supplied target) and
|
||||
reports latency, sampled process-tree CPU and peak memory, UTF-8 response size,
|
||||
and goto and warning-marker counts. Those counts are not a correctness judgement,
|
||||
and model tokens are not measured. Reference timings and response sizes are
|
||||
reported separately; reference caches expire when the server closes. `--report PATH` writes the JSON report.
|
||||
|
||||
The first matrix run used Kuna 1.833 and Ghidra 12.1.4 with JDK 21 on macOS
|
||||
arm64. It covered zlib 1.3.2 `minigzip`, coreutils 9.9 `sort` and the sqlite
|
||||
3.54.0 shell, built at `-O2` for ELF x86-64, ELF AArch64, Mach-O arm64 and
|
||||
Mach-O x86-64, each with symbols and stripped. A separate Linux x86-64 run verified
|
||||
the fixture and system zlib 1.2.13 / SQLite 3.40.1 libraries through MCP, including
|
||||
cached byte spans and a Ghidra comparison. See the [Linux report](https://github.com/morluto/rea/pull/3854#issuecomment-6185870391)
|
||||
for measured scope and limitations. Windows, PE and universal Mach-O remain
|
||||
unverified by this lane.
|
||||
|
||||
## DOS Ghidra analysis
|
||||
|
||||
`npm run verify:ghidra:dos` requires the supported Ghidra and JDK installation
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
{
|
||||
"base_revision": "e598b4656ad90d59ede2d10454a0ac34f3813558",
|
||||
"scope": "Canonical effect metadata only; real static Obsidian reads, no target execution",
|
||||
"baseline_source_sha256": {
|
||||
"src/contracts/toolEffects.ts": "39505b5f1501768515229a37ff67e8a1a512faedfb6669aee7a690a2ac3ac633",
|
||||
"src/javascript/analysis/JavaScriptAnalysisWorker.ts": "49ea4e6344060fae3529ffe6e14bfadc534132067cfa5c370263dc7476375be0",
|
||||
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1"
|
||||
},
|
||||
"final_source_sha256": {
|
||||
"src/contracts/toolEffects.ts": "feb66f1b71c4a6849d1730227c9c74e4efbb67b4537d75fd41ce9ff615c25753",
|
||||
"src/javascript/analysis/JavaScriptAnalysisWorker.ts": "49ea4e6344060fae3529ffe6e14bfadc534132067cfa5c370263dc7476375be0",
|
||||
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
|
||||
"tests/boundary/mcp/electronMcp.test.ts": "e483bec8512cfeafa7f951c8faf25e1aecd6e6987ea74aead14230501912928d",
|
||||
"tests/boundary/mcp/toolSchemaValidity.test.ts": "ab6d9ba37035a6ff9279b820aa8660c50a3ef9f31d25f838c0ba40929148e89c"
|
||||
},
|
||||
"cohorts": {
|
||||
"baseline": {
|
||||
"metadata": {
|
||||
"tool": "analyze_javascript_application",
|
||||
"advertised_annotations": {
|
||||
"readOnlyHint": false,
|
||||
"destructiveHint": false,
|
||||
"idempotentHint": true,
|
||||
"openWorldHint": false
|
||||
},
|
||||
"session_effects": ["mutatesSession", "idempotent"],
|
||||
"session_annotations": ["idempotent"],
|
||||
"catalog_tool_count": 207
|
||||
},
|
||||
"metadata_probe_resources": {
|
||||
"elapsed_seconds": 10.711,
|
||||
"cpu_seconds": 10.503415,
|
||||
"peak_cgroup_bytes": 842891264,
|
||||
"payload_cleanup_verified": true,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"real_workflow": {
|
||||
"artifact": {
|
||||
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
|
||||
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
|
||||
},
|
||||
"parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
|
||||
"samples": [
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 109.19401700000162,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"token_costs": {
|
||||
"tokenizer": "cl100k_base",
|
||||
"tiktoken_version": "0.12.0",
|
||||
"costs": {
|
||||
"references": {
|
||||
"selected_catalog": 7977,
|
||||
"full_catalog": 195522,
|
||||
"common_request": 53,
|
||||
"common_summary": 2675,
|
||||
"requests": 102,
|
||||
"structured_replies": 5741,
|
||||
"selected_catalog_task_total": 16548,
|
||||
"full_catalog_task_total": 204093
|
||||
}
|
||||
}
|
||||
},
|
||||
"cli_parity": {
|
||||
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"exact_cli_mcp_view_parity": true
|
||||
}
|
||||
},
|
||||
"real_workflow_resources": {
|
||||
"elapsed_seconds": 30.47,
|
||||
"cpu_seconds": 29.939807,
|
||||
"peak_cgroup_bytes": 1551282176,
|
||||
"payload_cleanup_verified": true,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"final": {
|
||||
"metadata": {
|
||||
"tool": "analyze_javascript_application",
|
||||
"advertised_annotations": {
|
||||
"readOnlyHint": false,
|
||||
"destructiveHint": false,
|
||||
"idempotentHint": true,
|
||||
"openWorldHint": true
|
||||
},
|
||||
"session_effects": [
|
||||
"mutatesSession",
|
||||
"writesFilesystem",
|
||||
"launchesProcess",
|
||||
"idempotent"
|
||||
],
|
||||
"session_annotations": ["idempotent", "open_world"],
|
||||
"catalog_tool_count": 207
|
||||
},
|
||||
"metadata_probe_resources": {
|
||||
"elapsed_seconds": 10.909,
|
||||
"cpu_seconds": 10.664997,
|
||||
"peak_cgroup_bytes": 853958656,
|
||||
"payload_cleanup_verified": true,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"real_workflow": {
|
||||
"artifact": {
|
||||
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
|
||||
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
|
||||
},
|
||||
"parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
|
||||
"samples": [
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 110.17946600000141,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"token_costs": {
|
||||
"tokenizer": "cl100k_base",
|
||||
"tiktoken_version": "0.12.0",
|
||||
"costs": {
|
||||
"references": {
|
||||
"selected_catalog": 7977,
|
||||
"full_catalog": 195522,
|
||||
"common_request": 53,
|
||||
"common_summary": 2675,
|
||||
"requests": 102,
|
||||
"structured_replies": 5741,
|
||||
"selected_catalog_task_total": 16548,
|
||||
"full_catalog_task_total": 204093
|
||||
}
|
||||
}
|
||||
},
|
||||
"cli_parity": {
|
||||
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"exact_cli_mcp_view_parity": true
|
||||
}
|
||||
},
|
||||
"real_workflow_resources": {
|
||||
"elapsed_seconds": 31.059,
|
||||
"cpu_seconds": 30.663163,
|
||||
"peak_cgroup_bytes": 1584574464,
|
||||
"payload_cleanup_verified": true,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conditions": "Separate fresh MCP sessions, uncontrolled warm filesystem/build and shared-host scheduling. One CPU, 8 GiB hard cap, 6 GiB early stop, no swap. Resource counters are at payload exit with the observer alive, not final whole-scope counters; memory includes charged file cache, not summed RSS. Whole real-verifier resources include analysis, export, CLI parity and tokenizer; metadata probe resources are separate. Static BPE uses name/description/inputSchema catalog projections plus requests/structured replies, excludes annotations, metadata-probe calls, rendering/replay/reasoning/final-answer/model usage. No performance improvement or equivalence bound established by one before/after pair.",
|
||||
"regressions": {
|
||||
"baseline": "20 executed: 2 expected metadata failures, 18 passed",
|
||||
"final": "27 passed after the test ownership cleanup across canonical effects and MCP/catalog boundaries",
|
||||
"interim_correction": "26 passed before metadata assertions were split into their own target-free case to satisfy function-size lint"
|
||||
},
|
||||
"selected_input": {
|
||||
"input_path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
|
||||
"detail": "summary",
|
||||
"source_paths": ["package.json", "main.js"]
|
||||
},
|
||||
"selected_view": {
|
||||
"kind": "javascript",
|
||||
"collection": "modules",
|
||||
"projection": "references",
|
||||
"where": {
|
||||
"path": "main.js",
|
||||
"kind": "javascript-module"
|
||||
}
|
||||
},
|
||||
"observer_sources_sha256": {
|
||||
"resource-run.py": "7728862171415e7dee2c11af2ead2b9a54265fccaf82a7113956d36b29065e33",
|
||||
"resource_payload.py": "6f089e645459eba80c5d73e39c21606c78173a44daf49fabc3b88c4631ce51c6"
|
||||
},
|
||||
"runtime": {
|
||||
"platform": "Linux x64",
|
||||
"node": "24.18.0",
|
||||
"npm": "11.16.0",
|
||||
"tiktoken": "0.12.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
# JavaScript analysis effect metadata verification
|
||||
|
||||
Tracks #3867 under #4027. The canonical effect record omitted existing internal
|
||||
worker launches and source staging. `CapabilityInventory` and SDK registration
|
||||
already consume that owner directly; no adapter override is required. The
|
||||
[worker](../../src/javascript/analysis/JavaScriptAnalysisWorker.ts) creates a
|
||||
private runtime root, stages `.source` files and launches an owned REA worker.
|
||||
These are source-derived facts; the analyzed application code is not executed.
|
||||
|
||||
## Executed results
|
||||
|
||||
Public stdio MCP before/after:
|
||||
|
||||
| Surface | Before | After |
|
||||
| ---------------------------- | ------------------------------ | ------------------------------------------ |
|
||||
| `tools/list` `openWorldHint` | `false` | `true` |
|
||||
| `binary_session` effects | `mutatesSession`, `idempotent` | also `writesFilesystem`, `launchesProcess` |
|
||||
| Session annotation flags | `idempotent` | also `open_world` |
|
||||
| Advertised tools | 207 | 207 |
|
||||
|
||||
Regression assertions failed on the original contract: **2 failed,
|
||||
18 passed**. After correction and separating the target-free metadata case, **27 passed** across canonical effects, public
|
||||
Electron/JavaScript MCP and SDK-converted catalog validity. The tests retain the
|
||||
non-destructive, idempotent hints and exact session effects; no foreign target
|
||||
execution is declared.
|
||||
|
||||
The existing real verifier analyzed official Obsidian 1.14.4 with `package.json`
|
||||
and `main.js` selected, then read the typed module references and verified exact
|
||||
public CLI/MCP parity. Both revisions returned the same parent/view Evidence
|
||||
identities and 23-row fact digest. Query replies remained 22,158 bytes and the
|
||||
selected-schema task remained 16,548 `cl100k_base` BPE tokens (204,093 with the full
|
||||
name/description/inputSchema catalog projection). These are static counts, not
|
||||
model billing; annotations, the separate metadata probe, host rendering/replay,
|
||||
reasoning and final answers are outside this projection. No hosted agent was run.
|
||||
|
||||
| Complete real verifier | Before | After |
|
||||
| ---------------------- | ------------: | ------------: |
|
||||
| Elapsed seconds | 30.470 | 31.059 |
|
||||
| CPU seconds | 29.939807 | 30.663163 |
|
||||
| Peak cgroup bytes | 1,551,282,176 | 1,584,574,464 |
|
||||
|
||||
The scope includes shared analysis, temporary export, CLI parity and tokenizer.
|
||||
The metadata-only probe separately used 10.711/10.909 s wall,
|
||||
10.503415/10.664997 s CPU and 842,891,264/853,958,656 B peak cgroup memory.
|
||||
All scopes used one CPU, an 8 GiB hard cap, 6 GiB early stop and no swap; cleanup
|
||||
was verified with no OOM. Memory includes charged file cache, not summed RSS.
|
||||
Counters were observed at payload exit while the observer remained alive.
|
||||
Fresh MCP sessions do not establish an OS-cold cache. Shared-host scheduling and
|
||||
filesystem/build warmness were uncontrolled; one pair establishes neither a
|
||||
performance improvement nor an equivalence bound. Linux x64 static ASAR analysis
|
||||
was executed; live Electron and other platforms were not exercised locally.
|
||||
[Compact records and source hashes](javascript-analysis-effects-2026-10-15.json)
|
||||
preserve these distinctions without archiving the downloadable application.
|
||||
|
||||
## Reproduce
|
||||
|
||||
Use pinned Node/npm, `npm ci`, then `npm run build:cached`. Run the following as
|
||||
an ES module from the checkout root (`node --input-type=module < probe.mjs`):
|
||||
|
||||
```javascript
|
||||
import assert from "node:assert/strict";
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { toolAvailabilityInventory } from "./dist/contracts/toolOutputSchemaPrimitives.js";
|
||||
import { closeVerifierResources } from "./scripts/lib/verifier-cleanup.mjs";
|
||||
|
||||
const client = new Client({
|
||||
name: "javascript-effect-verification",
|
||||
version: "1",
|
||||
});
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
args: ["scripts/rea.mjs", "mcp"],
|
||||
stderr: "pipe",
|
||||
});
|
||||
let primaryError;
|
||||
try {
|
||||
await client.connect(transport);
|
||||
transport.stderr?.resume();
|
||||
const { tools } = await client.listTools();
|
||||
const tool = tools.find(
|
||||
({ name }) => name === "analyze_javascript_application",
|
||||
);
|
||||
assert.ok(tool);
|
||||
const response = await client.callTool({
|
||||
name: "binary_session",
|
||||
arguments: {},
|
||||
});
|
||||
assert.notEqual(response.isError, true);
|
||||
const inventory = toolAvailabilityInventory.parse(
|
||||
response.structuredContent?.result?.tool_availability,
|
||||
);
|
||||
const group = inventory.groups.find(({ names }) => names.includes(tool.name));
|
||||
assert.ok(group);
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
tool: tool.name,
|
||||
advertised_annotations: tool.annotations,
|
||||
session_effects: group.effects,
|
||||
session_annotations: group.annotations,
|
||||
catalog_tool_count: tools.length,
|
||||
}),
|
||||
);
|
||||
} catch (cause) {
|
||||
primaryError = cause;
|
||||
throw cause;
|
||||
} finally {
|
||||
await closeVerifierResources(
|
||||
[() => client.close(), () => transport.close()],
|
||||
primaryError,
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
For the real workflow, follow the artifact acquisition/digest instructions in
|
||||
[module-reference verification](javascript-module-references-2026-10-15.md).
|
||||
Run its existing command with `--mode references --rounds 1 --cli-parity` and the
|
||||
same selected source paths and tokenizer. That verifier is unchanged by this
|
||||
fix. The preserved 8 GiB cgroup observer and its source hashes are documented in
|
||||
the same guide. The machine-readable records separate metadata-probe resources
|
||||
from the complete real-workflow resources.
|
||||
@@ -0,0 +1,691 @@
|
||||
{
|
||||
"base_revision": "c9f9b83c6f5878f1d5b102ab206a2ce214749258",
|
||||
"source_sha256": {
|
||||
"scripts/verify/javascript/module-references.mjs": "9d5f0b8b35ed2ebb4591f9dc3baea0fc116a0c3fd7d8e5ce30ec476c84671ed1",
|
||||
"src/contracts/analysisViewToolContracts.ts": "f7c64b3472e7ec1090f9d47ede864b8c9630d506d896454a800747f2c90a8960",
|
||||
"src/domain/analysisView/analysisView.ts": "854b03988791c19642b01d17813b379b51d8edc10d2190a3c236c9a1b2feb365",
|
||||
"src/domain/analysisView/javascriptApplicationView.ts": "f2c41ad15fdc9f891412c9161a832b60baf3dae55e3c4d60159098d07f7d1ef1",
|
||||
"src/domain/analysisView/javascriptModuleReferences.ts": "34c7a7ff466e9c49d43f1b11b72f878041de61a1bc09086ec190a5833b454806",
|
||||
"scripts/fixtures/tokenizer-family-wrapper.py": "2e9b7092ee539ae1c6a477492f05bb6007d4612dadfff9b90051d621de43049b"
|
||||
},
|
||||
"verification": {
|
||||
"scope": "Completed module-fact reads from identical retained Evidence; no hosted-model performance claim",
|
||||
"artifact": {
|
||||
"path": "/tmp/rea-codemode-experiment-20261015/artifacts/obsidian-1.14.4.asar",
|
||||
"sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f"
|
||||
},
|
||||
"parent_evidence_id": "ev_73ef06e3b9b944f54c5257f7960279127d8518d2a73cd8618bd045dbe44e6b5a",
|
||||
"source_selection": {
|
||||
"requested_paths": ["package.json", "main.js"],
|
||||
"unselected_files": 36
|
||||
},
|
||||
"source_coverage": {
|
||||
"application": {
|
||||
"status": "partial",
|
||||
"truncated": false,
|
||||
"omitted_count": null,
|
||||
"limits": []
|
||||
},
|
||||
"semantic": {
|
||||
"status": "partial",
|
||||
"truncated": false,
|
||||
"omitted_nodes": null,
|
||||
"omitted_relations": null,
|
||||
"limits": [],
|
||||
"families": [
|
||||
{
|
||||
"family": "boundary",
|
||||
"status": "partial",
|
||||
"retained_relations": 14,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
},
|
||||
{
|
||||
"family": "call-flow",
|
||||
"status": "partial",
|
||||
"retained_relations": 845,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 1278
|
||||
},
|
||||
{
|
||||
"family": "child-process",
|
||||
"status": "partial",
|
||||
"retained_relations": 0,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
},
|
||||
{
|
||||
"family": "closure",
|
||||
"status": "partial",
|
||||
"retained_relations": 1187,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
},
|
||||
{
|
||||
"family": "configuration",
|
||||
"status": "partial",
|
||||
"retained_relations": 0,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
},
|
||||
{
|
||||
"family": "data-flow",
|
||||
"status": "partial",
|
||||
"retained_relations": 9388,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 1135
|
||||
},
|
||||
{
|
||||
"family": "event",
|
||||
"status": "partial",
|
||||
"retained_relations": 127,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 89
|
||||
},
|
||||
{
|
||||
"family": "object-flow",
|
||||
"status": "partial",
|
||||
"retained_relations": 1462,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 2292
|
||||
},
|
||||
{
|
||||
"family": "promise-ownership",
|
||||
"status": "partial",
|
||||
"retained_relations": 80,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 98
|
||||
},
|
||||
{
|
||||
"family": "request",
|
||||
"status": "partial",
|
||||
"retained_relations": 0,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
},
|
||||
{
|
||||
"family": "resource-lifecycle",
|
||||
"status": "partial",
|
||||
"retained_relations": 4,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
},
|
||||
{
|
||||
"family": "timer",
|
||||
"status": "partial",
|
||||
"retained_relations": 8,
|
||||
"omitted_relations": null,
|
||||
"unknown_count": 31
|
||||
}
|
||||
]
|
||||
},
|
||||
"application_unknowns": 36,
|
||||
"semantic_unknowns": 5109
|
||||
},
|
||||
"where": {
|
||||
"path": "main.js",
|
||||
"kind": "javascript-module"
|
||||
},
|
||||
"preparation_ms": 20978.249922,
|
||||
"samples": [
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 363.02500200000213,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 14.895039999999426,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 12.951290000000881,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 232.7533779999976,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 235.16672899999685,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 10.566158999998152,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"token_costs": {
|
||||
"tokenizer": "cl100k_base",
|
||||
"tiktoken_version": "0.12.0",
|
||||
"costs": {
|
||||
"legacy": {
|
||||
"selected_catalog": 7977,
|
||||
"full_catalog": 195446,
|
||||
"common_request": 53,
|
||||
"common_summary": 2675,
|
||||
"requests": 2836,
|
||||
"structured_replies": 71761,
|
||||
"selected_catalog_task_total": 85302,
|
||||
"full_catalog_task_total": 272771
|
||||
},
|
||||
"references": {
|
||||
"selected_catalog": 7977,
|
||||
"full_catalog": 195446,
|
||||
"common_request": 53,
|
||||
"common_summary": 2675,
|
||||
"requests": 102,
|
||||
"structured_replies": 5741,
|
||||
"selected_catalog_task_total": 16548,
|
||||
"full_catalog_task_total": 204017
|
||||
}
|
||||
}
|
||||
},
|
||||
"cli_parity": {
|
||||
"evidence_id": "ev_b3586dfdf7d4f01157f8f2978326aaa7103987110f2df4fa5bf3331ff2898749",
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"exact_cli_mcp_view_parity": true
|
||||
},
|
||||
"conditions": "First query is after shared artifact analysis; subsequent queries share one MCP session. Legacy item reads are serial; a concurrent legacy baseline is unmeasured. Filesystem/build warmness uncontrolled. Token costs count one post-change catalog, preparation request/summary and each request/structured reply once; client rendering, replay, reasoning, final answer and model latency are unmeasured. Preparation and parity/tokenization overhead are outside per-query elapsed times; external family-resource receipts include the complete verifier and children."
|
||||
},
|
||||
"resources": {
|
||||
"scope": "Complete verifier, MCP/analysis descendants, temporary export, CLI parity and tokenizer; cgroup memory includes charged file cache and is not summed RSS",
|
||||
"elapsed_seconds": 35.797,
|
||||
"cpu_seconds": 35.197074,
|
||||
"peak_cgroup_bytes": 1938313216,
|
||||
"memory_max_bytes": 8589934592,
|
||||
"memory_early_stop_bytes": 6442450944,
|
||||
"cpu_quota_percent": 100,
|
||||
"payload_exit_code": 0,
|
||||
"payload_cleanup_verified": true,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
},
|
||||
"observer_sources_sha256": {
|
||||
"resource-run.py": "7728862171415e7dee2c11af2ead2b9a54265fccaf82a7113956d36b29065e33",
|
||||
"resource_payload.py": "6f089e645459eba80c5d73e39c21606c78173a44daf49fabc3b88c4631ce51c6"
|
||||
}
|
||||
},
|
||||
"prior_attempts": [
|
||||
{
|
||||
"scope": "Initial verifier incorrectly requested full MCP delivery; completed analysis exceeded existing response admission",
|
||||
"elapsed_seconds": 21.971,
|
||||
"cpu_seconds": 21.78546,
|
||||
"peak_cgroup_bytes": 1080860672,
|
||||
"outcome": "resource_constraint transport; verifier corrected to summary-first; no performance credit"
|
||||
},
|
||||
{
|
||||
"scope": "Interim successful parity run before eliminating verifier assertion serialization and counting the bootstrap request",
|
||||
"elapsed_seconds": 31.335,
|
||||
"cpu_seconds": 31.07044,
|
||||
"peak_cgroup_bytes": 1652293632,
|
||||
"outcome": "parity passed; superseded measurement, not pooled with final samples"
|
||||
},
|
||||
{
|
||||
"scope": "Successful three-pair probe before adding the shared analyze_javascript_application schema to selected-catalog accounting",
|
||||
"preparation_ms": 18317.110148,
|
||||
"samples": [
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 313.59318599999824,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 13.595478999999614,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 11.230690000000322,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 206.19418099999893,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 242.2037199999977,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 13.734700000000885,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"elapsed_seconds": 31.037,
|
||||
"cpu_seconds": 30.786998,
|
||||
"peak_cgroup_bytes": 1886543872,
|
||||
"outcome": "Facts and CLI/MCP parity passed. Selected-catalog totals omitted the common analysis-tool schema; superseded, not pooled. Shared-host timing differed substantially from the final run."
|
||||
},
|
||||
{
|
||||
"scope": "Completed three-pair probe with full token accounting before the review-added tokenizer deadline",
|
||||
"preparation_ms": 66696.731143,
|
||||
"samples": [
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 1114.080965000001,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 46.572758999987855,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 37.09324900001229,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 675.7124039999908,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 777.2660329999926,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 36.31178899999941,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"elapsed_seconds": 108.372,
|
||||
"cpu_seconds": 81.551676,
|
||||
"peak_cgroup_bytes": 1884962816,
|
||||
"outcome": "All facts/costs and CLI/MCP parity passed. Superseded execution source after adding a tokenizer deadline; retained separately, not pooled."
|
||||
},
|
||||
{
|
||||
"scope": "Successful data comparison with direct-child tokenizer timeout before adopting shared owned-process supervision",
|
||||
"preparation_ms": 19051.368892000002,
|
||||
"samples": [
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 330.7313439999998,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 0,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 13.62184999999954,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 12.475999999998749,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 1,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 187.18667300000016,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "legacy",
|
||||
"elapsed_ms": 293.4882039999975,
|
||||
"calls": 24,
|
||||
"structured_reply_bytes": 325201,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 55,
|
||||
"total": 55,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"mode": "references",
|
||||
"elapsed_ms": 8.146389999998064,
|
||||
"calls": 1,
|
||||
"structured_reply_bytes": 22158,
|
||||
"facts_sha256": "d3be5e91d2ec3fd9a95851cfbbdef9c168bb4c7153f78810b8b235e005401299",
|
||||
"matching_modules": 23,
|
||||
"coverage": {
|
||||
"status": "page",
|
||||
"examined": 23,
|
||||
"total": 23,
|
||||
"next_offset": null,
|
||||
"exhausted": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"elapsed_seconds": 30.742,
|
||||
"cpu_seconds": 30.425218,
|
||||
"peak_cgroup_bytes": 1592938496,
|
||||
"outcome": "Fact and cost parity passed. That harness only killed its immediate tokenizer child; superseded by process-family supervision and detached-helper verification."
|
||||
}
|
||||
],
|
||||
"prior_tokenizer_timeout_verifications": [
|
||||
{
|
||||
"artifact_sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f",
|
||||
"scenario": "Real Obsidian references plus CLI parity, then a deliberately stalled tokenizer",
|
||||
"injected_tokenizer_source": "#!/bin/sh\nexec /bin/sleep 30\n",
|
||||
"timeout_ms": 20,
|
||||
"observed_error_code": "ETIMEDOUT",
|
||||
"expected_payload_exit_code": 1,
|
||||
"payload_cleanup_verified": true,
|
||||
"remaining_owned_temporary_files": 0,
|
||||
"elapsed_seconds": 31.258,
|
||||
"cpu_seconds": 31.00025,
|
||||
"peak_cgroup_bytes": 1644077056,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
},
|
||||
"scope": "Robustness check; no efficiency credit",
|
||||
"limitation": "Immediate child only; did not test detached descendants and is superseded by the owned-family check."
|
||||
}
|
||||
],
|
||||
"tokenizer_timeout_verification": {
|
||||
"artifact_sha256": "146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f",
|
||||
"scenario": "Real Obsidian references and CLI parity, then an owned tokenizer wrapper with a detached SIGTERM-ignoring helper",
|
||||
"fixture": "scripts/fixtures/tokenizer-family-wrapper.py",
|
||||
"fixture_sha256": "2e9b7092ee539ae1c6a477492f05bb6007d4612dadfff9b90051d621de43049b",
|
||||
"timeout_ms": 2000,
|
||||
"observed_failure_type": "OwnedCommandFailure",
|
||||
"observed_reason": "timeout",
|
||||
"cleanup_failure": null,
|
||||
"expected_payload_exit_code": 1,
|
||||
"payload_cleanup_verified": true,
|
||||
"remaining_owned_temporary_files": 0,
|
||||
"helper_observation": {
|
||||
"pid": 2871108,
|
||||
"group": 2871108,
|
||||
"parent": 2871107,
|
||||
"run_id": "rea-module-token-f139b74a-dd83-498b-b663-e765104159ec",
|
||||
"detached": true,
|
||||
"ignores_sigterm": true
|
||||
},
|
||||
"elapsed_seconds": 55.08,
|
||||
"cpu_seconds": 45.245603,
|
||||
"peak_cgroup_bytes": 1563475968,
|
||||
"events_at_payload_exit": {
|
||||
"memory.events": {
|
||||
"low": 0,
|
||||
"high": 0,
|
||||
"max": 0,
|
||||
"oom": 0,
|
||||
"oom_kill": 0,
|
||||
"oom_group_kill": 0
|
||||
},
|
||||
"pids.events": {
|
||||
"max": 0
|
||||
}
|
||||
},
|
||||
"scope": "Robustness check; no efficiency credit. PIDs are observations; signaling authority comes from the shared process owner."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
# Retained JavaScript module-reference verification
|
||||
|
||||
Tracks #4092 under #4027 and the decision in #4091. This verifies an existing
|
||||
tool's data projection, without a code-mode host or SDK. [Machine-readable
|
||||
results](javascript-module-references-2026-10-15.json) pin the base revision,
|
||||
executed source hashes, samples, tokenizer and resource observations.
|
||||
|
||||
## Real application and question
|
||||
|
||||
Official Obsidian 1.14.4 ASAR, 27,477,966 bytes, SHA-256
|
||||
`146ef8470d8cbb4a6db209bdc19bf2bad13350444186c0fd93c31087b142b92f`.
|
||||
The [official gzip](https://github.com/obsidianmd/obsidian-releases/releases/download/v1.14.4/obsidian-1.14.4.asar.gz)
|
||||
has SHA-256 `d1ed428c363968774f0f3906e67d8a53a058ece0b6cdd924b07865977b2ada21`.
|
||||
Select `package.json` and `main.js`; the other 36 inventoried files remain
|
||||
explicitly unselected. No target code is executed.
|
||||
|
||||
Question: retrieve every retained `javascript-module` identity at exact path
|
||||
`main.js`, its retained source-range observation count, and distinct support
|
||||
states. Compare the existing module page plus full item reads with one filtered
|
||||
typed reference view. All six completed query samples use one identical retained
|
||||
parent. All 23 selected rows, identities, counts and support states match. Public
|
||||
CLI inline input and MCP retained input produce the exact same view and Evidence
|
||||
ID. This establishes producer-fact consistency, not independent extractor
|
||||
correctness or proof of runtime loading.
|
||||
|
||||
## Completed read costs
|
||||
|
||||
| Measurement | Existing page + items | Typed reference view |
|
||||
| ------------------------------------------------------------- | --------------------: | -------------------: |
|
||||
| Calls per query task | 24 | 1 |
|
||||
| Structured reply bytes | 325,201 | 22,158 |
|
||||
| First query in its arm, after preparation | 363.03 ms | 14.90 ms |
|
||||
| Subsequent same-session query times | 232.75 / 235.17 ms | 12.95 / 10.57 ms |
|
||||
| Request + structured-reply BPE tokens | 74,597 | 5,843 |
|
||||
| With selected tool catalog + shared bootstrap request/summary | 85,302 | 16,548 |
|
||||
| With complete tool catalog + shared bootstrap request/summary | 272,771 | 204,017 |
|
||||
|
||||
Order alternates: existing/reference, reference/existing, existing/reference.
|
||||
Times include verifier-side fact normalization and equality checks; byte/token
|
||||
accounting follows the timed reads. The initial artifact analysis and summary
|
||||
took 20.978 seconds and is shared preparation, not a query-speed improvement.
|
||||
The retained source remains partial; unknown counts and source selection are
|
||||
preserved independently of exhausted pages. No query cache was introduced.
|
||||
|
||||
Tokens are `cl100k_base` counts with tiktoken 0.12.0 over serialized values, not
|
||||
hosted-model usage. Catalog projections contain name/description/inputSchema;
|
||||
both workflows use the same post-change catalog. Each request/reply is counted
|
||||
once. Output schemas, host-specific rendering/replay, reasoning, final answers,
|
||||
agent success rates and model latency are unmeasured. This is a completed
|
||||
data-retrieval comparison; it does not establish a whole-agent speedup or a
|
||||
before/after catalog-size improvement. Legacy item reads are serial; a concurrent
|
||||
legacy baseline was not measured. Selected discovery includes both the
|
||||
analysis and view tool schemas. Builds/filesystem are warm or uncontrolled,
|
||||
so the first query is not an OS-cold analysis measurement. Shared-host scheduling
|
||||
was uncontrolled: an earlier successful probe had substantially higher wall/CPU
|
||||
times. Its samples are retained separately; neither run establishes a portable
|
||||
latency guarantee.
|
||||
|
||||
The complete final verifier scope used 35.797 seconds elapsed, 35.197 seconds
|
||||
CPU and 1,938,313,216 bytes peak cgroup memory. This includes shared analysis,
|
||||
both query arms, temporary export, CLI parity and tokenization; CPU/memory were
|
||||
not isolated by arm. Cgroup memory includes charged file cache and is not summed
|
||||
process RSS. The whole scope had one CPU, an 8 GiB hard memory cap, 6 GiB early
|
||||
stop and no swap. Payload cleanup was verified; no OOM/capacity event occurred.
|
||||
An earlier full-response transport failure and interim probes are recorded
|
||||
separately in the JSON and earn no performance credit.
|
||||
|
||||
A review follow-up exercised a stalled tokenizer after real Obsidian reference
|
||||
reads and CLI parity. The committed POSIX fault fixture forks a helper into a
|
||||
separate process group, ignores SIGTERM and stalls. With a caller-selected
|
||||
2,000 ms deadline, the shared owned-command supervisor reported
|
||||
`OwnedCommandFailure` with reason `timeout` and no cleanup failure. The verifier
|
||||
failed as expected, its complete owned scope was cleaned, and its selected
|
||||
temporary root was empty. The separate robustness run used 55.080 s wall /
|
||||
45.246 s CPU / 1,563,475,968 B peak cgroup memory, with cleanup verified and no
|
||||
OOM. It earns no efficiency credit. An earlier 20 ms immediate-child timeout
|
||||
probe did not establish descendant cleanup; it remains a separate prior attempt.
|
||||
The detached-helper scenario was executed on Linux, not Windows or macOS.
|
||||
|
||||
A deterministic CI regression also asserts two retained
|
||||
observations at the same source range, excludes an unavailable location, and
|
||||
checks agreement with the full item view; the count deliberately measures
|
||||
observations rather than unique source sites.
|
||||
|
||||
## Reproduce
|
||||
|
||||
Use the pinned Node/npm toolchain and `npm ci`, then `npm run build:cached`.
|
||||
Download/decompress the versioned application outside the checkout and check its
|
||||
digest. Run with an operator-selected absolute artifact path:
|
||||
|
||||
```bash
|
||||
node scripts/verify/javascript/module-references.mjs \
|
||||
--artifact /absolute/path/obsidian-1.14.4.asar \
|
||||
--source-path package.json --source-path main.js \
|
||||
--path main.js --kind javascript-module --rounds 3 --cli-parity \
|
||||
--tokenizer-python /absolute/path/to/tiktoken-venv/bin/python
|
||||
```
|
||||
|
||||
The optional Python interpreter needs tiktoken 0.12.0; omit that flag to skip
|
||||
token accounting. It has a 60-second wall-time deadline, configurable with the
|
||||
positive integer `--tokenizer-timeout-ms`. The tokenizer uses the existing
|
||||
owned-command supervisor, with native identity checks and inherited run-token
|
||||
sweeping for descendants. Inputs and temporary Evidence use the existing private
|
||||
runtime root. Cleanup attempts preserve the primary error; incomplete command
|
||||
cleanup retains its owner and private files for recovery. `--mode legacy` or
|
||||
`--mode references` runs one arm. Fresh runs
|
||||
reanalyze the artifact and can produce different parent identities/resource
|
||||
coverage; the verifier requires equal facts within its paired run. The measured
|
||||
run additionally used the preserved [8 GiB cgroup observer](https://github.com/morluto/rea/blob/b3bdabab694af1f9801eff7caf75001b92314a58/experiments/analysis-efficiency/resource-run.py)
|
||||
and its adjacent `resource_payload.py`; observer hashes are in the JSON.
|
||||
No application, complete bundle, raw observations or ambient environment is
|
||||
archived. Temporary exported/inline Evidence files are removed after successful
|
||||
owned-command cleanup.
|
||||
|
||||
For the Linux descendant-timeout check, create an operator-selected private
|
||||
directory and set `REA_TOKENIZER_PROBE_RECORD` to a file within it. Run the same
|
||||
real-artifact command with `--mode references --rounds 1`, replace the tokenizer
|
||||
with the absolute path to `scripts/fixtures/tokenizer-family-wrapper.py`, and add
|
||||
`--tokenizer-timeout-ms 2000`. Expect a timeout failure. The explicit marker
|
||||
confirms the detached helper started; the resource observer must separately
|
||||
verify the complete owned scope is empty, and the selected temporary root must
|
||||
contain no verifier files. The recorded PID is an observation, not authority to
|
||||
signal that process.
|
||||
@@ -17,7 +17,7 @@ additional permission flag or degraded mode is required.
|
||||
- Node.js 22.x (>=22.19), 24.x (>=24.11), or 26+;
|
||||
- an operator-installed Ghidra 12.1.x distribution (verified with 12.1.4);
|
||||
- a 64-bit full JDK inside that installation's declared Java range (JDK 21 or newer, with no maximum, for current 12.1 releases);
|
||||
- an explicit native, non-managed x86 or x86-64 PE application/DLL, or a
|
||||
- an explicit native, non-managed x86, x86-64, ARMNT (Thumb-2) or ARM64 PE application/DLL, or a
|
||||
[raw NMOS 6502 image](raw-binary.md#nmos-6502) with a caller-supplied entry; and
|
||||
- the 26 read-only Ghidra inventory, memory, and function-analysis operations.
|
||||
|
||||
@@ -135,9 +135,55 @@ and artifact SHA-256 before loading the package-owned addon. Native failure
|
||||
reasons remain distinct from a valid installation and an unsupported target.
|
||||
|
||||
PE header classification and SHA-256 come from the same open file. The Windows
|
||||
provider admits native x86 and x86-64 PE applications and DLLs and rejects unsupported roles,
|
||||
provider admits native x86, x86-64, ARMNT (Thumb-2) and ARM64 PE applications and DLLs and rejects unsupported roles,
|
||||
architectures, managed images, and malformed headers. The original selected
|
||||
source coordinate is preserved for native admission.
|
||||
source coordinate is preserved for native admission. The original COFF machine is
|
||||
retained separately from the normalized CPU family. ARM admission requires the
|
||||
observed ARMNT machine 0x01C4; ARM64 requires 0xAA64. Legacy ARM (0x01C0), Thumb
|
||||
(0x01C2), and unavailable machine facts do not select this Windows lane.
|
||||
Without a caller-selected processor override, Ghidra's PE loader
|
||||
selects the language from the PE machine field: ARM (`IMAGE_FILE_MACHINE_ARMNT`)
|
||||
imports as `ARM:LE:32:v8` (Thumb), ARM64 (`IMAGE_FILE_MACHINE_ARM64`) as
|
||||
`AARCH64:LE:64:v8A`. Explicit language/compiler selections remain caller choices
|
||||
in the analysis profile and are recorded as explicit imports. The source
|
||||
fixture verifier compares the complete observed language ID, not just its CPU
|
||||
family prefix. ARM/ARM64 admission is a bounded extension of the x86/x64
|
||||
lane. `npm run verify:ghidra:windows -- --arm` or `-- --arm64`, optionally
|
||||
combined with `--dll`, selects encoded Thumb or ARM64 PE fixtures on a Windows
|
||||
x64 host. The packaged verifier accepts the same flags. These fixtures are not
|
||||
compiler-produced programs. ARM64EC (machine 0xA641) and ARM64X are not admitted;
|
||||
this target support does not establish Windows-on-Arm host support.
|
||||
|
||||
Real Windows x64 verification with Ghidra 12.1.4 and JDK 21 completed the ARM64
|
||||
application and ARMNT/Thumb DLL fixtures' 26 read-only operations, constant-return
|
||||
decompilation, byte searches, CLI/MCP file-offset parity, source identity, and
|
||||
owned cleanup. The DLL fixture also verifies the exported caller/callee
|
||||
relationship. The x86/x64 compact-reference value-flow battery does not cover
|
||||
ARM or ARM64 instructions. ARM64 EXE file-offset verification includes ambiguous
|
||||
mappings; the single-section ARM32 DLL cannot exercise that case.
|
||||
|
||||
The runs used two logical CPUs, 512 MiB Node/JVM heaps, a 900-second startup
|
||||
budget, and an explicit `REA_GHIDRA_DISABLED_ANALYZERS=WindowsResourceReference`
|
||||
test configuration. Default-analyzer runs exceeded the selected startup budget;
|
||||
resource-reference analysis and default-configuration completion are not
|
||||
established by these results. A Microsoft-signed Coreinfo ARM64 application also
|
||||
completed focused MCP decompilation, repeated readback, source-mapped memory
|
||||
reads, unchanged-input and cleanup checks. On this constrained host the first
|
||||
function query, including cold analysis, took about 434 seconds; its identical
|
||||
same-session read took about 23 ms and returned about 4.6 KiB of Evidence. These
|
||||
are individual observations, not general latency guarantees. Public ARM32
|
||||
DLL verification also completed against Microsoft Visual C++ 2013 ARM
|
||||
`msvcr120.dll`, including decompilation of its exported `abs`, repeated readback,
|
||||
source-mapped bytes, unchanged-input and cleanup checks. Its first function
|
||||
query took about 601 seconds; the same-session repeat took about 11 ms and
|
||||
returned about 4.8 KiB of Evidence. After preserving original COFF machines in the
|
||||
admission/profile, a further real Windows check rejected legacy ARM/Thumb and
|
||||
retained ARMNT/ARM64 admission. A rebuilt-candidate MSVCR120 query completed
|
||||
in about 407 seconds with a 15 ms repeat (4,830 bytes of Evidence), unchanged
|
||||
input and complete cleanup. That retry selected an 1,800-second startup budget
|
||||
after an additional 900-second attempt timed out. The resource bounds were
|
||||
unchanged; these observations do not establish a speedup. Configured processor
|
||||
selection is covered by profile tests, not these real-provider runs.
|
||||
|
||||
Admission opens and checks every path component without following a reparse
|
||||
point. It retains handles, verifies local NTFS semantics, and observes volume
|
||||
@@ -200,6 +246,8 @@ npm run verify:ghidra:windows
|
||||
npm run verify:ghidra:windows -- --x86
|
||||
npm run verify:ghidra:windows -- --dll
|
||||
npm run verify:ghidra:windows -- --x86 --dll
|
||||
npm run verify:ghidra:windows -- --arm64
|
||||
npm run verify:ghidra:windows -- --arm64 --dll
|
||||
npm run verify:ghidra:windows:package -- --x86
|
||||
npm run verify:ghidra:windows:package -- --dll
|
||||
npm run verify:ghidra:windows:package -- --x86 --dll
|
||||
|
||||
@@ -2,7 +2,7 @@ REA npm dependency inventory
|
||||
Prepared from the root package-lock.json; refresh this inventory when locked dependencies change.
|
||||
License identifiers are upstream lockfile declarations, not a legal assessment.
|
||||
Runtime includes transitive and optional platform packages; development includes build, test and website tooling.
|
||||
Locked package entries: 721; runtime: 177.
|
||||
Locked package entries: 722; runtime: 178.
|
||||
Full runtime copyright/license/NOTICE texts: npm-runtime-notices.txt.
|
||||
|
||||
@algolia/abtesting@1.25.0 | development | MIT
|
||||
@@ -2740,6 +2740,11 @@ oniguruma-to-es@3.1.1 | development | MIT
|
||||
Package: https://www.npmjs.com/package/oniguruma-to-es/v/3.1.1
|
||||
Archive: https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-3.1.1.tgz
|
||||
Integrity: sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ==
|
||||
openpgp@6.3.2 | runtime | LGPL-3.0+
|
||||
Lockfile path: node_modules/openpgp
|
||||
Package: https://www.npmjs.com/package/openpgp/v/6.3.2
|
||||
Archive: https://registry.npmjs.org/openpgp/-/openpgp-6.3.2.tgz
|
||||
Integrity: sha512-wcZTzHz41LV8Y48zH/JlD1JT8YdNmpWOuMAjQ/podvvCwsjBEU37K3znJh4UQcj3hksE5z9TzvhbUbwzsGvlLQ==
|
||||
oxc-parser@0.150.0 | development | MIT
|
||||
Lockfile path: node_modules/oxc-parser
|
||||
Package: https://www.npmjs.com/package/oxc-parser/v/0.150.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
REA third-party npm runtime copyright, license and NOTICE texts
|
||||
Collected from integrity-verified locked npm archives. Release-specific supplements and upstream notice gaps are identified in their entries.
|
||||
External engines are separately obtained; see THIRD_PARTY_NOTICES.md.
|
||||
Runtime dependency fingerprint (SHA-256): 49b181923ab240c68c64d35ecdd8f93cb5cd516c765f2282d0e0eca0bcadd13e
|
||||
Runtime dependency fingerprint (SHA-256): 131100b2e1e6ad5e55b10a0baf4be2d7a0838fd724fb307b9bafd73446b0d3ec
|
||||
|
||||
===== @babel/helper-string-parser@8.0.6 =====
|
||||
Declared license: MIT
|
||||
@@ -5171,6 +5171,180 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
===== openpgp@6.3.2 =====
|
||||
Declared license: LGPL-3.0+
|
||||
Archive: https://registry.npmjs.org/openpgp/-/openpgp-6.3.2.tgz
|
||||
Integrity: sha512-wcZTzHz41LV8Y48zH/JlD1JT8YdNmpWOuMAjQ/podvvCwsjBEU37K3znJh4UQcj3hksE5z9TzvhbUbwzsGvlLQ==
|
||||
Scope: npm runtime dependency. GPLv3 terms incorporated by this LGPL text are preserved in licenses/GPL-3.0.txt.
|
||||
|
||||
--- package/LICENSE ---
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
||||
===== pako@1.0.11 =====
|
||||
Declared license: (MIT AND Zlib)
|
||||
Archive: https://registry.npmjs.org/pako/-/pako-1.0.11.tgz
|
||||
|
||||
@@ -111,7 +111,9 @@ automatically. Alternatively, build it using the Linux/MinGW lane above.
|
||||
- Cleanup walks locked directory objects, removes files by handle, and unlinks
|
||||
reparse entries without traversing their targets. Failed removal retains the
|
||||
root and ancestor leases for retry; a partially removed runtime accepts only
|
||||
cleanup, and its registry entry remains until removal succeeds. Normal close, cancellation,
|
||||
cleanup, and its registry entry remains until removal succeeds. The owned root
|
||||
handle includes attribute-write access so cleanup can clear a read-only marker,
|
||||
matching the child cleanup handles. Normal close, cancellation,
|
||||
startup failure, and timeout release provider resources. Abrupt owner death
|
||||
kills the owned job. The Android provider additionally uses a detached helper
|
||||
that owns its private runtime directory and cleans it when the owner pipe
|
||||
@@ -156,8 +158,11 @@ npm run verify:windows-native
|
||||
npm run verify:ghidra:windows
|
||||
```
|
||||
|
||||
The native inspection probe retains its directory owner if deletion fails. A
|
||||
later availability query retries that cleanup before creating another probe;
|
||||
An unpublished runtime retains its directory and parent handles if validation,
|
||||
result publication, or rollback fails. Errors retain the original failure and
|
||||
any rollback failure. Later runtime creation or native inspection retries that
|
||||
exact owner before allocating another directory. The same owner covers the
|
||||
native inspection probe. A later availability query retries failed probe cleanup;
|
||||
successful admission and static artifact failures remain cached. Environment
|
||||
teardown makes one final cleanup attempt and reports a persistent failure to
|
||||
stderr rather than claiming the directory was removed.
|
||||
@@ -174,9 +179,11 @@ On Windows, after compiling the runtime:
|
||||
node scripts/verify-windows-native-inspection.mjs
|
||||
```
|
||||
|
||||
This artifact injects one access-denied disposition result while using a real
|
||||
NTFS directory. The verifier checks retained ownership, recovery on a later
|
||||
query, cached successful admission, and cleanup on environment teardown. It
|
||||
This artifact injects an access-denied disposition result while using real
|
||||
NTFS directories, and separately denies post-create validation and rollback.
|
||||
The verifier checks retained ownership after inspection and direct runtime
|
||||
creation failures, recovery on later admission, cached successful inspection,
|
||||
and cleanup on environment teardown. It
|
||||
renames the retained probe and recreates its old path, checking that cleanup
|
||||
removes the owned inode while preserving the replacement directory.
|
||||
It does not reproduce or identify the host-dependent cause reported in #1701.
|
||||
|
||||
Generated
+19
@@ -34,6 +34,7 @@
|
||||
"isomorphic-git": "1.38.7",
|
||||
"jsonc-parser": "3.3.1",
|
||||
"lossless-json": "4.3.1",
|
||||
"openpgp": "6.3.2",
|
||||
"parse5": "8.0.1",
|
||||
"pino": "10.4.0",
|
||||
"playwright-core": "1.58.2",
|
||||
@@ -7871,6 +7872,24 @@
|
||||
"regex-recursion": "^6.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/openpgp": {
|
||||
"version": "6.3.2",
|
||||
"resolved": "https://registry.npmjs.org/openpgp/-/openpgp-6.3.2.tgz",
|
||||
"integrity": "sha512-wcZTzHz41LV8Y48zH/JlD1JT8YdNmpWOuMAjQ/podvvCwsjBEU37K3znJh4UQcj3hksE5z9TzvhbUbwzsGvlLQ==",
|
||||
"license": "LGPL-3.0+",
|
||||
"engines": {
|
||||
"node": ">= 18.0.0",
|
||||
"typescript": ">= 5.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@openpgp/web-stream-tools": "~0.3.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@openpgp/web-stream-tools": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/oxc-parser": {
|
||||
"version": "0.150.0",
|
||||
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.150.0.tgz",
|
||||
|
||||
+5
-2
@@ -194,6 +194,7 @@
|
||||
"verify:ghidra:swift": "npm run build:cached && node scripts/verify-real-ghidra-swift.mjs",
|
||||
"verify:ida": "npm run build:cached && node scripts/verify-real-ida.mjs",
|
||||
"verify:ghidra:switch": "npm run build:cached && node scripts/verify-real-ghidra-switch.mjs",
|
||||
"verify:kuna": "npm run build:cached && node scripts/verify-real-kuna.mjs",
|
||||
"verify:ghidra:dos": "npm run build:cached && node scripts/verify-real-ghidra-dos.mjs",
|
||||
"verify:ghidra:com": "npm run build:cached && node scripts/verify-real-ghidra-com.mjs",
|
||||
"verify:ghidra:raw": "npm run build:cached && node scripts/verify-real-ghidra-raw.mjs",
|
||||
@@ -212,6 +213,7 @@
|
||||
"verify:javascript-runtime": "npm run build:cached && node scripts/verify/javascript/runtime-observation.mjs",
|
||||
"verify:javascript:digests": "npm run build:cached && node scripts/verify/javascript/digests.mjs",
|
||||
"verify:javascript:output": "npm run build:cached && node scripts/verify/javascript/output.mjs",
|
||||
"verify:javascript:module-references": "npm run build:cached && node scripts/verify/javascript/module-references.mjs",
|
||||
"verify:application-workflows": "npm run build:cached && node scripts/verify/javascript/application-workflows.mjs",
|
||||
"verify:managed": "npm run build:cached && node scripts/verify/managed/conformance.mjs",
|
||||
"verify:firmware": "npm run build:cached && node scripts/verify/firmware/analysis.mjs",
|
||||
@@ -290,8 +292,8 @@
|
||||
"verify:solidity:metadata": "npm run build:cached && node scripts/verify-solidity-metadata.mjs",
|
||||
"verify:recorded:crash": "npm run build:cached && node scripts/verify-recorded-crash.mjs",
|
||||
"mcp-catalog:check:built": "node scripts/generate-mcp-tool-catalog.mjs --check",
|
||||
"compile": "node scripts/clean-build-output.mjs && tsc -p tsconfig.build.json && node scripts/bundle-runtime.mjs",
|
||||
"compile:termux": "node scripts/clean-build-output.mjs && node --max-old-space-size=3072 node_modules/typescript-termux/lib/tsc.js -p tsconfig.build.json && node scripts/bundle-runtime.mjs",
|
||||
"compile": "node scripts/clean-build-output.mjs && tsc -p tsconfig.build.json && node scripts/record-catalog-digests.mjs && node scripts/bundle-runtime.mjs",
|
||||
"compile:termux": "node scripts/clean-build-output.mjs && node --max-old-space-size=3072 node_modules/typescript-termux/lib/tsc.js -p tsconfig.build.json && node scripts/record-catalog-digests.mjs && node scripts/bundle-runtime.mjs",
|
||||
"artifacts:mcp-catalog": "node scripts/generate-mcp-tool-catalog.mjs",
|
||||
"artifacts:skills": "node scripts/generate-skill-metadata.mjs",
|
||||
"artifacts:product-catalog": "node scripts/generate-product-catalog.mjs",
|
||||
@@ -337,6 +339,7 @@
|
||||
"isomorphic-git": "1.38.7",
|
||||
"jsonc-parser": "3.3.1",
|
||||
"lossless-json": "4.3.1",
|
||||
"openpgp": "6.3.2",
|
||||
"parse5": "8.0.1",
|
||||
"pino": "10.4.0",
|
||||
"playwright-core": "1.58.2",
|
||||
|
||||
@@ -3,42 +3,52 @@ import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { writeWindowsGhidraByteSearchFixture } from "./lib/ghidra-windows-byte-search.mjs";
|
||||
|
||||
import {
|
||||
WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES,
|
||||
windowsGhidraFixtureOptions,
|
||||
} from "./lib/ghidra-windows-fixture-options.mjs";
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
// Source-owned static fixtures: no compiler, target loading or execution.
|
||||
for (const architecture of ["x86_64", "x86"]) {
|
||||
for (const architecture of WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES) {
|
||||
for (const dll of [false, true]) {
|
||||
const x86 = architecture === "x86";
|
||||
const output = resolve(
|
||||
root,
|
||||
"build",
|
||||
"fixtures",
|
||||
`rea-ghidra-windows${x86 ? "-x86" : ""}.${dll ? "dll" : "exe"}`,
|
||||
);
|
||||
const arm = architecture === "arm";
|
||||
const arm64 = architecture === "arm64";
|
||||
const fixture = windowsGhidraFixtureOptions([
|
||||
...(architecture === "x86_64" ? [] : [`--${architecture}`]),
|
||||
...(dll ? ["--dll"] : []),
|
||||
]);
|
||||
const pe32 = fixture.pe32;
|
||||
const output = resolve(root, "build", "fixtures", fixture.filename);
|
||||
const bytes = Buffer.alloc(dll ? 1024 : 1536);
|
||||
const peOffset = 0x80;
|
||||
const optionalHeader = peOffset + 24;
|
||||
const optionalHeaderSize = x86 ? 0xe0 : 0xf0;
|
||||
const optionalHeaderSize = pe32 ? 0xe0 : 0xf0;
|
||||
const sectionTable = optionalHeader + optionalHeaderSize;
|
||||
const directories = optionalHeader + (x86 ? 96 : 112);
|
||||
const directories = optionalHeader + (pe32 ? 96 : 112);
|
||||
|
||||
bytes.write("MZ", 0, "ascii");
|
||||
bytes.writeUInt32LE(peOffset, 0x3c);
|
||||
bytes.write("PE\0\0", peOffset, "binary");
|
||||
bytes.writeUInt16LE(x86 ? 0x14c : 0x8664, peOffset + 4);
|
||||
// The fixture descriptor owns COFF machine, width and function coordinates.
|
||||
bytes.writeUInt16LE(fixture.machine, peOffset + 4);
|
||||
bytes.writeUInt16LE(dll ? 1 : 2, peOffset + 6);
|
||||
bytes.writeUInt16LE(optionalHeaderSize, peOffset + 20);
|
||||
bytes.writeUInt16LE(
|
||||
(x86 ? 0x102 : 0x22) | (dll ? 0x2000 : 0),
|
||||
(pe32 ? 0x102 : 0x22) | (dll ? 0x2000 : 0),
|
||||
peOffset + 22,
|
||||
);
|
||||
|
||||
bytes.writeUInt16LE(x86 ? 0x10b : 0x20b, optionalHeader);
|
||||
// ARM64 PE uses the PE32+ optional header (magic 0x20b), like x86-64.
|
||||
bytes.writeUInt16LE(pe32 ? 0x10b : 0x20b, optionalHeader);
|
||||
bytes.writeUInt32LE(0x200, optionalHeader + 4);
|
||||
if (!dll) bytes.writeUInt32LE(0x200, optionalHeader + 8);
|
||||
bytes.writeUInt32LE(dll ? 0 : 0x1000, optionalHeader + 16);
|
||||
bytes.writeUInt32LE(dll ? 0 : arm ? 0x1001 : 0x1000, optionalHeader + 16);
|
||||
bytes.writeUInt32LE(0x1000, optionalHeader + 20);
|
||||
if (x86) bytes.writeUInt32LE(0x400000, optionalHeader + 28);
|
||||
else bytes.writeBigUInt64LE(0x1_4000_0000n, optionalHeader + 24);
|
||||
if (pe32)
|
||||
bytes.writeUInt32LE(Number(fixture.imageBase), optionalHeader + 28);
|
||||
else bytes.writeBigUInt64LE(fixture.imageBase, optionalHeader + 24);
|
||||
bytes.writeUInt32LE(0x1000, optionalHeader + 32);
|
||||
bytes.writeUInt32LE(0x200, optionalHeader + 36);
|
||||
bytes.writeUInt16LE(6, optionalHeader + 40);
|
||||
@@ -46,8 +56,8 @@ for (const architecture of ["x86_64", "x86"]) {
|
||||
bytes.writeUInt32LE(dll ? 0x2000 : 0x3000, optionalHeader + 56);
|
||||
bytes.writeUInt32LE(0x200, optionalHeader + 60);
|
||||
bytes.writeUInt16LE(3, optionalHeader + 68);
|
||||
bytes.writeUInt16LE(x86 ? 0x8140 : 0x8160, optionalHeader + 70);
|
||||
if (x86) {
|
||||
bytes.writeUInt16LE(pe32 ? 0x8140 : 0x8160, optionalHeader + 70);
|
||||
if (pe32) {
|
||||
bytes.writeUInt32LE(0x10_0000, optionalHeader + 72);
|
||||
bytes.writeUInt32LE(0x1000, optionalHeader + 76);
|
||||
bytes.writeUInt32LE(0x10_0000, optionalHeader + 80);
|
||||
@@ -69,18 +79,52 @@ for (const architecture of ["x86_64", "x86"]) {
|
||||
bytes.writeUInt32LE(0x6000_0020, sectionTable + 36);
|
||||
|
||||
// EXE entry returns zero. DLL caller adds one to the callee's 42.
|
||||
bytes.set(
|
||||
dll
|
||||
? [0xe8, 0x0b, 0, 0, 0, 0x83, 0xc0, 1, 0xc3]
|
||||
: [0xe8, 0x0b, 0, 0, 0, 0xe8, 0x16, 0, 0, 0, 0x31, 0xc0, 0xc3],
|
||||
0x200,
|
||||
);
|
||||
bytes.set(
|
||||
x86 && !dll
|
||||
? [0xb8, 0x2a, 0, 0, 0, 0xe8, 0x66, 0, 0, 0, 0xc3]
|
||||
: [0xb8, 0x2a, 0, 0, 0, 0xc3],
|
||||
0x210,
|
||||
);
|
||||
if (arm) {
|
||||
// ARMNT uses Thumb instructions and low-bit-tagged PE entry/export RVAs.
|
||||
// PUSH keeps SP aligned and preserves LR across BL from 0x1002 to 0x1020.
|
||||
bytes.set(
|
||||
[
|
||||
0x10,
|
||||
0xb5,
|
||||
0x00,
|
||||
0xf0,
|
||||
0x0d,
|
||||
0xf8,
|
||||
dll ? 0x01 : 0x00,
|
||||
dll ? 0x30 : 0x20,
|
||||
0x10,
|
||||
0xbd,
|
||||
],
|
||||
0x200,
|
||||
);
|
||||
bytes.set([0x2a, 0x20, 0x70, 0x47], 0x220);
|
||||
} else if (arm64) {
|
||||
// Preserve the caller's frame/link registers across BL. The callee
|
||||
// starts at RVA 0x1020, outside the five-instruction caller.
|
||||
const instructions = [
|
||||
0xa9bf7bfd, // STP X29, X30, [SP, #-16]!
|
||||
0x94000007, // BL +0x1c from RVA 0x1004 to RVA 0x1020
|
||||
dll ? 0x11000400 : 0x52800000, // ADD W0,W0,#1 / MOV W0,#0
|
||||
0xa8c17bfd, // LDP X29, X30, [SP], #16
|
||||
0xd65f03c0, // RET
|
||||
];
|
||||
for (const [index, instruction] of instructions.entries())
|
||||
bytes.writeUInt32LE(instruction, 0x200 + index * 4);
|
||||
bytes.set([0x40, 0x05, 0x80, 0x52, 0xc0, 0x03, 0x5f, 0xd6], 0x220);
|
||||
} else {
|
||||
bytes.set(
|
||||
dll
|
||||
? [0xe8, 0x0b, 0, 0, 0, 0x83, 0xc0, 1, 0xc3]
|
||||
: [0xe8, 0x0b, 0, 0, 0, 0xe8, 0x16, 0, 0, 0, 0x31, 0xc0, 0xc3],
|
||||
0x200,
|
||||
);
|
||||
bytes.set(
|
||||
x86 && !dll
|
||||
? [0xb8, 0x2a, 0, 0, 0, 0xe8, 0x66, 0, 0, 0, 0xc3]
|
||||
: [0xb8, 0x2a, 0, 0, 0, 0xc3],
|
||||
0x210,
|
||||
);
|
||||
}
|
||||
|
||||
if (x86 && !dll) {
|
||||
// A statically analyzed Borland-style SEH registration whose handler
|
||||
@@ -149,19 +193,31 @@ for (const architecture of ["x86_64", "x86"]) {
|
||||
"ffd7", // CALL EDI: unknown target.
|
||||
"c3",
|
||||
]
|
||||
: [
|
||||
"488d15d90f0000", // LEA RDX, [RIP + displacement]: DATA.
|
||||
"8b05d30f0000", // MOV EAX, [RIP + displacement]: READ.
|
||||
"8905d10f0000", // MOV [RIP + displacement], EAX: WRITE.
|
||||
"488d15d60f0000", // Indexed base, unknown RCX.
|
||||
"85db", // TEST EBX, EBX: two candidate bases.
|
||||
"7407", // JZ over the alternate base.
|
||||
"488d15d30f0000", // LEA RDX, alternate base.
|
||||
"c6040a01", // MOV byte [RDX + RCX], 1.
|
||||
"41ffd0", // CALL R8: unknown target.
|
||||
"c3",
|
||||
];
|
||||
bytes.set(Buffer.from(referenceInstructions.join(""), "hex"), 0x220);
|
||||
: arm
|
||||
? ["7047"] // Thumb return; x86 reference-flow controls do not apply.
|
||||
: arm64
|
||||
? [
|
||||
"010000b0", // ADRP X1, .data page (RVA 0x2000): DATA.
|
||||
"200040b9", // LDR W0, [X1]: READ.
|
||||
"200000b9", // STR W0, [X1]: WRITE.
|
||||
"c0035fd6", // RET.
|
||||
]
|
||||
: [
|
||||
"488d15d90f0000", // LEA RDX, [RIP + displacement]: DATA.
|
||||
"8b05d30f0000", // MOV EAX, [RIP + displacement]: READ.
|
||||
"8905d10f0000", // MOV [RIP + displacement], EAX: WRITE.
|
||||
"488d15d60f0000", // Indexed base, unknown RCX.
|
||||
"85db", // TEST EBX, EBX: two candidate bases.
|
||||
"7407", // JZ over the alternate base.
|
||||
"488d15d30f0000", // LEA RDX, alternate base.
|
||||
"c6040a01", // MOV byte [RDX + RCX], 1.
|
||||
"41ffd0", // CALL R8: unknown target.
|
||||
"c3",
|
||||
];
|
||||
bytes.set(
|
||||
Buffer.from(referenceInstructions.join(""), "hex"),
|
||||
arm || arm64 ? 0x230 : 0x220,
|
||||
);
|
||||
}
|
||||
|
||||
if (dll) {
|
||||
@@ -176,8 +232,8 @@ for (const architecture of ["x86_64", "x86"]) {
|
||||
bytes.writeUInt32LE(0x1080, exports + 28);
|
||||
bytes.writeUInt32LE(0x1088, exports + 32);
|
||||
bytes.writeUInt32LE(0x1090, exports + 36);
|
||||
bytes.writeUInt32LE(0x1000, 0x280);
|
||||
bytes.writeUInt32LE(0x1010, 0x284);
|
||||
bytes.writeUInt32LE(arm ? 0x1001 : 0x1000, 0x280);
|
||||
bytes.writeUInt32LE(fixture.calleeRva + (arm ? 1 : 0), 0x284);
|
||||
bytes.writeUInt32LE(0x1120, 0x288);
|
||||
bytes.writeUInt32LE(0x1140, 0x28c);
|
||||
bytes.writeUInt16LE(0, 0x290);
|
||||
@@ -191,6 +247,6 @@ for (const architecture of ["x86_64", "x86"]) {
|
||||
|
||||
await mkdir(dirname(output), { recursive: true });
|
||||
await writeFile(output, bytes);
|
||||
if (!x86 && !dll) process.stdout.write(`${output}\n`);
|
||||
if (architecture === "x86_64" && !dll) process.stdout.write(`${output}\n`);
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,22 @@ export async function startBrowserVerifierSite() {
|
||||
return;
|
||||
}
|
||||
const requestUrl = new URL(request.url ?? "/", "http://127.0.0.1");
|
||||
if (requestUrl.pathname === "/scenario-request-language") {
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.setHeader("cache-control", "no-store");
|
||||
response.end(JSON.stringify(request.headers["accept-language"] ?? null));
|
||||
return;
|
||||
}
|
||||
if (requestUrl.pathname === "/scenario-environment") {
|
||||
const requestedRun = requestUrl.searchParams.get("run");
|
||||
const run = ["A", "B", "C"].includes(requestedRun)
|
||||
? requestedRun
|
||||
: "default";
|
||||
response.setHeader("content-type", "text/html");
|
||||
response.end(`<!doctype html><html><body data-run="${run}"><pre id="environment"></pre>
|
||||
const requestLanguage = encodeURIComponent(
|
||||
JSON.stringify(request.headers["accept-language"] ?? null),
|
||||
);
|
||||
response.end(`<!doctype html><html><body data-run="${run}" data-request-language="${requestLanguage}"><pre id="environment"></pre><pre id="language"></pre>
|
||||
<button id="refresh-environment">Refresh environment</button><script>
|
||||
const refresh = () => document.querySelector('#environment').textContent = JSON.stringify({
|
||||
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
@@ -26,6 +35,10 @@ export async function startBrowserVerifierSite() {
|
||||
dpr: devicePixelRatio, width: innerWidth, height: innerHeight
|
||||
});
|
||||
document.querySelector('#refresh-environment').onclick = refresh;
|
||||
document.querySelector('#language').textContent = JSON.stringify({
|
||||
language: navigator.language, languages: [...navigator.languages],
|
||||
request_language: JSON.parse(decodeURIComponent(document.body.dataset.requestLanguage))
|
||||
});
|
||||
window.releaseScenario = () => {
|
||||
const release = document.createElement('span');
|
||||
release.id = 'release-' + document.body.dataset.run;
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""POSIX fault fixture for the optional module-reference token counter.
|
||||
|
||||
Use as --tokenizer-python with an explicit REA_TOKENIZER_PROBE_RECORD path.
|
||||
It deliberately ignores the counter arguments, forks a detached helper that
|
||||
ignores SIGTERM, and stalls. The production owned-command supervisor must
|
||||
terminate the verified family. Recorded PIDs are observations, not authority
|
||||
to signal a process; verification also checks the owned scope after exit.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import signal
|
||||
import time
|
||||
|
||||
|
||||
def main():
|
||||
record = Path(os.environ["REA_TOKENIZER_PROBE_RECORD"])
|
||||
child = os.fork()
|
||||
if child == 0:
|
||||
os.setsid()
|
||||
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
||||
record.write_text(json.dumps({
|
||||
"pid": os.getpid(),
|
||||
"group": os.getpgrp(),
|
||||
"parent": os.getppid(),
|
||||
"run_id": os.environ.get("REA_PROCESS_RUN_ID"),
|
||||
"detached": True,
|
||||
"ignores_sigterm": True,
|
||||
}) + "\n", encoding="utf-8")
|
||||
time.sleep(30)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+12
-10
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Inspect or activate Hopper's version-pinned demo dialog on a private X display."""
|
||||
"""Inspect or activate Hopper's authenticated demo dialog on a private X display."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -8,6 +8,7 @@ import ctypes
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
import secrets
|
||||
import select
|
||||
@@ -18,12 +19,6 @@ import threading
|
||||
import time
|
||||
|
||||
|
||||
# Keep this digest aligned with LinuxHopper.ts and rerun real-Hopper verification
|
||||
# before accepting another vendor build.
|
||||
SUPPORTED_HOPPER_SHA256 = {
|
||||
"0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded",
|
||||
"1339f9e58377442b0c6fcb0dfc3cec20d593cc557408521fad9a00dbc6b8da13",
|
||||
}
|
||||
EXPECTED_SCREEN = (1280, 1024)
|
||||
DIALOG_TITLES = {"Registration", "Registration — Hopper Disassembler"}
|
||||
HOPPER_WINDOW_TITLE = "Hopper Disassembler"
|
||||
@@ -121,6 +116,7 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument("--probe", action="store_true")
|
||||
parser.add_argument("--owner-stdin", action="store_true")
|
||||
parser.add_argument("--hopper")
|
||||
parser.add_argument("--expected-launcher-sha256")
|
||||
parser.add_argument("--socket")
|
||||
parser.add_argument(
|
||||
"--strategy",
|
||||
@@ -661,7 +657,11 @@ def run_probe(args: argparse.Namespace) -> dict[str, object]:
|
||||
|
||||
|
||||
def run_launch(args: argparse.Namespace) -> int:
|
||||
if args.hopper is None or args.socket is None:
|
||||
if (
|
||||
args.hopper is None or args.socket is None
|
||||
or args.expected_launcher_sha256 is None
|
||||
or re.fullmatch(r"[a-f0-9]{64}", args.expected_launcher_sha256) is None
|
||||
):
|
||||
raise AdapterFailure(
|
||||
INVALID_LAUNCH_COMMAND,
|
||||
"invalid_launch_command",
|
||||
@@ -673,7 +673,9 @@ def run_launch(args: argparse.Namespace) -> int:
|
||||
hopper = Path(args.hopper)
|
||||
socket = Path(args.socket)
|
||||
try:
|
||||
supported = digest(hopper) in SUPPORTED_HOPPER_SHA256
|
||||
# The parent owns publisher/package interpretation. Recheck its admitted
|
||||
# launcher bytes immediately before execution, preserving all X11 guards.
|
||||
supported = digest(hopper) == args.expected_launcher_sha256
|
||||
except OSError as error:
|
||||
raise AdapterFailure(
|
||||
INVALID_LAUNCH_COMMAND,
|
||||
@@ -684,7 +686,7 @@ def run_launch(args: argparse.Namespace) -> int:
|
||||
raise AdapterFailure(
|
||||
UNSUPPORTED_HOPPER_BUILD,
|
||||
"unsupported_hopper_build",
|
||||
"unsupported Hopper binary",
|
||||
"Hopper binary differs from the authenticated release",
|
||||
)
|
||||
command = args.command[1:] if args.command[:1] == ["--"] else args.command
|
||||
if not command or Path(command[0]).resolve() != hopper.resolve():
|
||||
|
||||
@@ -4,11 +4,14 @@ import { fileURLToPath } from "node:url";
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
|
||||
import { CdpCommandRejection } from "../../dist/browser/CdpCommandRejection.js";
|
||||
import { CdpConnection } from "../../dist/browser/CdpConnection.js";
|
||||
import { createBrowserScenarioProvider } from "../../dist/composition/browserScenario.js";
|
||||
import { browserScenarioSchema } from "../../dist/domain/browserScenario.js";
|
||||
import { AnalysisCancelledError } from "../../dist/domain/analysisErrorCore.js";
|
||||
import { runScenarioCli } from "./browser-scenario-verifier.mjs";
|
||||
import { requireMcpEvidenceResult } from "./mcp-verifier-results.mjs";
|
||||
import { closeVerifierResources } from "./verifier-cleanup.mjs";
|
||||
|
||||
const expected = {
|
||||
timezone: "Pacific/Honolulu",
|
||||
@@ -24,12 +27,24 @@ const alternate = {
|
||||
width: 700,
|
||||
height: 500,
|
||||
};
|
||||
const expression = `JSON.stringify({
|
||||
const environmentExpression = `{
|
||||
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
locale: Intl.DateTimeFormat().resolvedOptions().locale,
|
||||
dpr: devicePixelRatio, width: innerWidth, height: innerHeight
|
||||
}`;
|
||||
const expression = `JSON.stringify(${environmentExpression})`;
|
||||
const scenarioSnapshotExpression = `JSON.stringify({
|
||||
timeOrigin: performance.timeOrigin,
|
||||
environment: ${environmentExpression},
|
||||
run: document.body?.dataset.run ?? null
|
||||
})`;
|
||||
|
||||
const isNavigationTransitionRejection = (cause) =>
|
||||
cause instanceof CdpCommandRejection &&
|
||||
cause.command === "Runtime.evaluate" &&
|
||||
cause.code === -32_000 &&
|
||||
cause.reportedMessage === "Inspected target navigated or closed";
|
||||
|
||||
const environmentScenario = ({ endpoint, targetId, origin, values, run }) =>
|
||||
browserScenarioSchema.parse({
|
||||
browser: { mode: "connect", cdp_endpoint: endpoint, target_id: targetId },
|
||||
@@ -82,8 +97,32 @@ const assertCapture = (capture, values = expected) => {
|
||||
}
|
||||
};
|
||||
|
||||
const assertCallerLanguage = (capture, baseline) => {
|
||||
assert.ok(
|
||||
capture.limitations.some((value) =>
|
||||
value.includes("Attached locale fr-FR applies to Intl formatting only"),
|
||||
),
|
||||
"Attached capture must identify its page/request language limitation",
|
||||
);
|
||||
for (const step of capture.steps) {
|
||||
const text = step.artifacts.dom.value.text;
|
||||
const observed = /<pre id="language">([^<]+)<\/pre>/u.exec(text);
|
||||
assert.ok(
|
||||
observed,
|
||||
"DOM omitted the navigator/request language observations",
|
||||
);
|
||||
assert.deepEqual(JSON.parse(observed[1]), baseline);
|
||||
}
|
||||
};
|
||||
|
||||
/** Verify actual attached-page emulation and restoration across scenario outcomes. */
|
||||
export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
const languageExpression = `(async () => JSON.stringify({
|
||||
language: navigator.language, languages: [...navigator.languages],
|
||||
request_language: await (await fetch(
|
||||
${JSON.stringify(`${origin}/scenario-request-language`)}, { cache: "no-store" }
|
||||
)).json()
|
||||
}))()`;
|
||||
const targets = await (await fetch(`${endpoint}/json/list`)).json();
|
||||
const target = targets.find(({ id }) => id === targetId);
|
||||
assert.ok(target, "External fixture target is missing");
|
||||
@@ -91,28 +130,38 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
target.webSocketDebuggerUrl,
|
||||
"capture_browser_scenario",
|
||||
);
|
||||
const readEnvironment = async () => {
|
||||
const readEnvironment = async (expressionToRead = expression) => {
|
||||
const value = await connection.send("Runtime.evaluate", {
|
||||
expression,
|
||||
expression: expressionToRead,
|
||||
returnByValue: true,
|
||||
awaitPromise: true,
|
||||
});
|
||||
assert.equal(value.result.type, "string");
|
||||
return JSON.parse(value.result.value);
|
||||
};
|
||||
const baseline = await readEnvironment();
|
||||
const scenario = environmentScenario({
|
||||
endpoint,
|
||||
targetId,
|
||||
origin,
|
||||
values: expected,
|
||||
});
|
||||
const assertRestored = async () => {
|
||||
assert.deepEqual(await readEnvironment(), baseline);
|
||||
const remaining = await (await fetch(`${endpoint}/json/list`)).json();
|
||||
assert.ok(remaining.some(({ id }) => id === targetId));
|
||||
};
|
||||
const provider = createBrowserScenarioProvider(process.env);
|
||||
let verificationError;
|
||||
try {
|
||||
assertCapture((await runScenarioCli(scenario)).normalized_result);
|
||||
const baseline = await readEnvironment();
|
||||
const callerLanguage = await readEnvironment(languageExpression);
|
||||
const scenario = environmentScenario({
|
||||
endpoint,
|
||||
targetId,
|
||||
origin,
|
||||
values: expected,
|
||||
});
|
||||
const assertRestored = async () => {
|
||||
assert.deepEqual(await readEnvironment(), baseline);
|
||||
assert.deepEqual(
|
||||
await readEnvironment(languageExpression),
|
||||
callerLanguage,
|
||||
);
|
||||
const remaining = await (await fetch(`${endpoint}/json/list`)).json();
|
||||
assert.ok(remaining.some(({ id }) => id === targetId));
|
||||
};
|
||||
const cliCapture = (await runScenarioCli(scenario)).normalized_result;
|
||||
assertCapture(cliCapture);
|
||||
assertCallerLanguage(cliCapture, callerLanguage);
|
||||
await assertRestored();
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
@@ -130,15 +179,15 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
({ name }) => name === "capture_browser_scenario",
|
||||
);
|
||||
assert.ok(definition, "Scenario tool is absent from the current catalog");
|
||||
assertCapture(
|
||||
requireMcpEvidenceResult(
|
||||
await client.callTool(
|
||||
{ name: "capture_browser_scenario", arguments: scenario },
|
||||
{ toolDefinition: definition },
|
||||
),
|
||||
"capture_browser_scenario",
|
||||
const mcpCapture = requireMcpEvidenceResult(
|
||||
await client.callTool(
|
||||
{ name: "capture_browser_scenario", arguments: scenario },
|
||||
{ toolDefinition: definition },
|
||||
),
|
||||
"capture_browser_scenario",
|
||||
);
|
||||
assertCapture(mcpCapture);
|
||||
assertCallerLanguage(mcpCapture, callerLanguage);
|
||||
await verifyConcurrentMcpCapture({
|
||||
client,
|
||||
definition,
|
||||
@@ -146,7 +195,6 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
endpoint,
|
||||
targetId,
|
||||
origin,
|
||||
readEnvironment,
|
||||
assertRestored,
|
||||
});
|
||||
} finally {
|
||||
@@ -154,7 +202,6 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
await transport.close();
|
||||
}
|
||||
await assertRestored();
|
||||
const provider = createBrowserScenarioProvider(process.env);
|
||||
const initializationFailure = await provider.captureScenario({
|
||||
...scenario,
|
||||
environment: { ...scenario.environment, timezone: "REA/Invalid" },
|
||||
@@ -178,12 +225,7 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
assertCapture(actionFailure.value);
|
||||
assert.equal(actionFailure.value.steps.at(-1).status, "failed");
|
||||
await assertRestored();
|
||||
await verifyCancelledEnvironment(
|
||||
provider,
|
||||
connection,
|
||||
waiting,
|
||||
readEnvironment,
|
||||
);
|
||||
await verifyCancelledEnvironment(provider, connection, waiting);
|
||||
await assertRestored();
|
||||
return {
|
||||
mocked: false,
|
||||
@@ -191,13 +233,21 @@ export async function verifyScenarioEnvironment(endpoint, targetId, origin) {
|
||||
stdio_mcp: true,
|
||||
observed: expected,
|
||||
restored: baseline,
|
||||
caller_language_preserved: callerLanguage,
|
||||
attached_locale_limitation: true,
|
||||
initialization_failure_cleanup: true,
|
||||
action_failure_cleanup: true,
|
||||
cancellation_cleanup: true,
|
||||
external_target_preserved: true,
|
||||
};
|
||||
} catch (cause) {
|
||||
verificationError = cause;
|
||||
throw cause;
|
||||
} finally {
|
||||
await connection.close();
|
||||
await closeVerifierResources(
|
||||
[() => provider.close(), () => connection.close()],
|
||||
verificationError,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +258,6 @@ const verifyConcurrentMcpCapture = async ({
|
||||
endpoint,
|
||||
targetId,
|
||||
origin,
|
||||
readEnvironment,
|
||||
assertRestored,
|
||||
}) => {
|
||||
const firstScenario = environmentScenario({
|
||||
@@ -241,12 +290,13 @@ const verifyConcurrentMcpCapture = async ({
|
||||
|
||||
try {
|
||||
const first = callTool(firstScenario, firstCancellation.signal);
|
||||
await waitForEnvironment(readEnvironment, connection, expected, "A");
|
||||
await waitForEnvironment(connection, expected, "A");
|
||||
|
||||
const second = callTool(secondScenario, secondCancellation.signal);
|
||||
await client.ping();
|
||||
assert.deepEqual(await readEnvironment(), expected);
|
||||
assert.equal(await readScenarioRun(connection), "A");
|
||||
const firstSnapshot = await readScenarioSnapshot(connection);
|
||||
assert.deepEqual(firstSnapshot.environment, expected);
|
||||
assert.equal(firstSnapshot.run, "A");
|
||||
|
||||
const cancelled = callTool(
|
||||
environmentScenario({
|
||||
@@ -261,8 +311,9 @@ const verifyConcurrentMcpCapture = async ({
|
||||
await client.ping();
|
||||
cancellation.abort(new Error("cancel queued browser scenario"));
|
||||
await assert.rejects(cancelled, /cancel queued browser scenario/u);
|
||||
assert.deepEqual(await readEnvironment(), expected);
|
||||
assert.equal(await readScenarioRun(connection), "A");
|
||||
const queuedSnapshot = await readScenarioSnapshot(connection);
|
||||
assert.deepEqual(queuedSnapshot.environment, expected);
|
||||
assert.equal(queuedSnapshot.run, "A");
|
||||
|
||||
await releaseScenario(connection);
|
||||
assertCapture(
|
||||
@@ -270,7 +321,7 @@ const verifyConcurrentMcpCapture = async ({
|
||||
expected,
|
||||
);
|
||||
|
||||
await waitForEnvironment(readEnvironment, connection, alternate, "B");
|
||||
await waitForEnvironment(connection, alternate, "B");
|
||||
await releaseScenario(connection);
|
||||
assertCapture(
|
||||
requireMcpEvidenceResult(await second, "capture_browser_scenario"),
|
||||
@@ -287,31 +338,57 @@ const verifyConcurrentMcpCapture = async ({
|
||||
}
|
||||
};
|
||||
|
||||
const waitForEnvironment = async (
|
||||
readEnvironment,
|
||||
connection,
|
||||
expectedValues,
|
||||
run,
|
||||
) => {
|
||||
const deadline = Date.now() + 10_000;
|
||||
while (Date.now() < deadline) {
|
||||
if (
|
||||
JSON.stringify(await readEnvironment()) ===
|
||||
JSON.stringify(expectedValues) &&
|
||||
(await readScenarioRun(connection)) === run
|
||||
)
|
||||
return;
|
||||
await delay(25);
|
||||
}
|
||||
throw new Error(`Scenario ${run} never reached its page-controlled gate`);
|
||||
const waitForEnvironment = async (connection, expectedValues, run) => {
|
||||
await waitForScenarioSnapshot(
|
||||
connection,
|
||||
(snapshot) =>
|
||||
JSON.stringify(snapshot.environment) === JSON.stringify(expectedValues) &&
|
||||
snapshot.run === run,
|
||||
`Scenario ${run} never reached its page-controlled gate`,
|
||||
);
|
||||
};
|
||||
|
||||
const readScenarioRun = async (connection) => {
|
||||
const value = await connection.send("Runtime.evaluate", {
|
||||
expression: "document.body.dataset.run ?? null",
|
||||
returnByValue: true,
|
||||
});
|
||||
return value.result.value;
|
||||
const waitForScenarioSnapshot = async (connection, accept, message) => {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), 10_000);
|
||||
let lastTransitionRejection;
|
||||
try {
|
||||
while (!controller.signal.aborted) {
|
||||
try {
|
||||
const snapshot = await readScenarioSnapshot(
|
||||
connection,
|
||||
controller.signal,
|
||||
);
|
||||
if (controller.signal.aborted) break;
|
||||
if (accept(snapshot)) return;
|
||||
} catch (cause) {
|
||||
if (
|
||||
controller.signal.aborted &&
|
||||
cause instanceof AnalysisCancelledError
|
||||
)
|
||||
break;
|
||||
if (!isNavigationTransitionRejection(cause)) throw cause;
|
||||
lastTransitionRejection = cause;
|
||||
}
|
||||
await delay(25);
|
||||
}
|
||||
throw new Error(message, {
|
||||
cause: lastTransitionRejection ?? controller.signal.reason,
|
||||
});
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
};
|
||||
|
||||
const readScenarioSnapshot = async (connection, signal) => {
|
||||
const value = await connection.send(
|
||||
"Runtime.evaluate",
|
||||
{ expression: scenarioSnapshotExpression, returnByValue: true },
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
assert.equal(value.result.type, "string");
|
||||
return JSON.parse(value.result.value);
|
||||
};
|
||||
|
||||
const releaseScenario = async (connection) => {
|
||||
@@ -321,44 +398,41 @@ const releaseScenario = async (connection) => {
|
||||
});
|
||||
};
|
||||
|
||||
async function verifyCancelledEnvironment(
|
||||
export async function verifyCancelledEnvironment(
|
||||
provider,
|
||||
connection,
|
||||
scenario,
|
||||
readEnvironment,
|
||||
) {
|
||||
const controller = new AbortController();
|
||||
const priorNavigation = await connection.send("Runtime.evaluate", {
|
||||
expression: "performance.timeOrigin",
|
||||
returnByValue: true,
|
||||
});
|
||||
const priorSnapshot = await readScenarioSnapshot(connection);
|
||||
const pending = provider.captureScenario(
|
||||
{ ...scenario, actions: [{ ...scenario.actions[0], timeout_ms: 30_000 }] },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
const settlement = Promise.allSettled([pending]);
|
||||
try {
|
||||
const deadline = Date.now() + 10_000;
|
||||
while (true) {
|
||||
const navigation = await connection.send("Runtime.evaluate", {
|
||||
expression: "performance.timeOrigin",
|
||||
returnByValue: true,
|
||||
});
|
||||
if (
|
||||
navigation.result.value !== priorNavigation.result.value &&
|
||||
JSON.stringify(await readEnvironment()) === JSON.stringify(expected)
|
||||
)
|
||||
break;
|
||||
assert.ok(Date.now() < deadline, "Scenario never applied emulation");
|
||||
await delay(25);
|
||||
}
|
||||
await waitForScenarioSnapshot(
|
||||
connection,
|
||||
(snapshot) =>
|
||||
snapshot.timeOrigin !== priorSnapshot.timeOrigin &&
|
||||
JSON.stringify(snapshot.environment) === JSON.stringify(expected),
|
||||
"Scenario never applied emulation",
|
||||
);
|
||||
await delay(100);
|
||||
} finally {
|
||||
controller.abort();
|
||||
await settlement;
|
||||
}
|
||||
const cancelled = await pending;
|
||||
assert.ok(
|
||||
!cancelled.ok ||
|
||||
if (!cancelled.ok) {
|
||||
if (!(cancelled.error instanceof AnalysisCancelledError))
|
||||
throw cancelled.error;
|
||||
assert.equal(cancelled.error.cleanupIncomplete, false);
|
||||
} else {
|
||||
assert.ok(
|
||||
cancelled.value.steps.some(({ status }) => status === "cancelled"),
|
||||
"Cancellation unexpectedly completed every action",
|
||||
);
|
||||
"Cancellation unexpectedly completed every action",
|
||||
);
|
||||
assert.equal(cancelled.value.browser.cleanup, "disconnected-external");
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
runScenarioCli,
|
||||
scenarioProfiles,
|
||||
} from "./browser-scenario-verifier.mjs";
|
||||
import { closeVerifierResources } from "./verifier-cleanup.mjs";
|
||||
|
||||
const scenarioFor = (browser, origin) =>
|
||||
browserScenarioSchema.parse({
|
||||
@@ -299,6 +300,7 @@ const verifyConnectedStorage = async (endpoint, targetId, origin) => {
|
||||
target.webSocketDebuggerUrl,
|
||||
"capture_browser_scenario",
|
||||
);
|
||||
let failure;
|
||||
try {
|
||||
await assertStorageKeyPartition(observer, origin);
|
||||
const result = await runScenarioCli(scenario);
|
||||
@@ -313,11 +315,14 @@ const verifyConnectedStorage = async (endpoint, targetId, origin) => {
|
||||
assert.equal(capture.browser.cleanup, "disconnected-external");
|
||||
await verifyCallerDebuggerPause(observer, origin, scenario);
|
||||
await verifyCancelledStorage(observer, endpoint, targetId, scenario);
|
||||
} catch (cause) {
|
||||
failure = cause;
|
||||
throw cause;
|
||||
} finally {
|
||||
await raceWithTimeout(restoreTarget(observer, target.url), 1_000).catch(
|
||||
() => undefined,
|
||||
await closeVerifierResources(
|
||||
[() => restoreTarget(observer, target.url), () => observer.close()],
|
||||
failure,
|
||||
);
|
||||
await raceWithTimeout(observer.close(), 1_000).catch(() => undefined);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -503,7 +508,8 @@ const verifyCallerDebuggerPause = async (caller, origin, scenario) => {
|
||||
],
|
||||
});
|
||||
let settled = false;
|
||||
const pending = createBrowserScenarioProvider(process.env)
|
||||
const provider = createBrowserScenarioProvider(process.env);
|
||||
const pending = provider
|
||||
.captureScenario(debuggerScenario, { signal: controller.signal })
|
||||
.finally(() => {
|
||||
settled = true;
|
||||
@@ -586,9 +592,10 @@ const verifyCallerDebuggerPause = async (caller, origin, scenario) => {
|
||||
});
|
||||
} finally {
|
||||
unsubscribe();
|
||||
await raceWithTimeout(caller.send("Debugger.disable"), 1_000).catch(
|
||||
() => undefined,
|
||||
);
|
||||
await closeVerifierResources([
|
||||
() => caller.send("Debugger.disable"),
|
||||
() => provider.close(),
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -615,38 +622,48 @@ const verifyCancelledStorage = async (
|
||||
expression: "performance.timeOrigin",
|
||||
returnByValue: true,
|
||||
});
|
||||
const pending = createBrowserScenarioProvider(process.env).captureScenario(
|
||||
cancelledScenario,
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
await waitForNewDocument(
|
||||
observer,
|
||||
"/storage-main",
|
||||
priorDocument.result.value,
|
||||
);
|
||||
const state = await observer.send("Runtime.evaluate", {
|
||||
expression:
|
||||
"JSON.parse(document.querySelector('#main-report').textContent)",
|
||||
returnByValue: true,
|
||||
const provider = createBrowserScenarioProvider(process.env);
|
||||
const pending = provider.captureScenario(cancelledScenario, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
assert.deepEqual(state.result.value, {
|
||||
local: "main-initial",
|
||||
session: "main-session-initial",
|
||||
removed: "main-remove-seed",
|
||||
empty: "main-empty-seed",
|
||||
});
|
||||
controller.abort(new Error("cancel storage seed scenario"));
|
||||
const result = await pending;
|
||||
assert.ok(
|
||||
!result.ok ||
|
||||
result.value.steps.some(({ status }) => status === "cancelled"),
|
||||
"Cancellation unexpectedly completed every scenario step",
|
||||
);
|
||||
const targets = await (await fetch(`${endpoint}/json/list`)).json();
|
||||
assert.ok(
|
||||
targets.some(({ id }) => id === targetId),
|
||||
"Cancelled connect-mode storage cleanup closed the external target",
|
||||
);
|
||||
let failure;
|
||||
try {
|
||||
await waitForNewDocument(
|
||||
observer,
|
||||
"/storage-main",
|
||||
priorDocument.result.value,
|
||||
);
|
||||
const state = await observer.send("Runtime.evaluate", {
|
||||
expression:
|
||||
"JSON.parse(document.querySelector('#main-report').textContent)",
|
||||
returnByValue: true,
|
||||
});
|
||||
assert.deepEqual(state.result.value, {
|
||||
local: "main-initial",
|
||||
session: "main-session-initial",
|
||||
removed: "main-remove-seed",
|
||||
empty: "main-empty-seed",
|
||||
});
|
||||
controller.abort(new Error("cancel storage seed scenario"));
|
||||
const result = await pending;
|
||||
if (result.ok)
|
||||
assert.ok(
|
||||
result.value.steps.some(({ status }) => status === "cancelled"),
|
||||
"Cancellation unexpectedly completed every scenario step",
|
||||
);
|
||||
else assert.equal(result.error._tag, "AnalysisCancelledError");
|
||||
const targets = await (await fetch(`${endpoint}/json/list`)).json();
|
||||
assert.ok(
|
||||
targets.some(({ id }) => id === targetId),
|
||||
"Cancelled connect-mode storage cleanup closed the external target",
|
||||
);
|
||||
} catch (cause) {
|
||||
failure = cause;
|
||||
throw cause;
|
||||
} finally {
|
||||
controller.abort(new Error("cancel failed storage verification"));
|
||||
await closeVerifierResources([() => provider.close()], failure);
|
||||
}
|
||||
};
|
||||
|
||||
const waitForNewDocument = async (connection, path, priorTimeOrigin) => {
|
||||
@@ -669,15 +686,38 @@ const waitForNewDocument = async (connection, path, priorTimeOrigin) => {
|
||||
};
|
||||
|
||||
const restoreTarget = async (connection, url) => {
|
||||
await connection.send("Page.navigate", { url });
|
||||
const deadline = Date.now() + 10_000;
|
||||
while (Date.now() < deadline) {
|
||||
const result = await connection.send("Runtime.evaluate", {
|
||||
expression: "location.href",
|
||||
returnByValue: true,
|
||||
});
|
||||
if (result.result.value === url) return;
|
||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||
const loaded = new Set();
|
||||
let loaderId;
|
||||
let resolveLoaded;
|
||||
const load = new Promise((resolve) => {
|
||||
resolveLoaded = resolve;
|
||||
});
|
||||
const unsubscribe = connection.onEvent((event) => {
|
||||
if (
|
||||
event.method !== "Page.lifecycleEvent" ||
|
||||
event.params?.name !== "load" ||
|
||||
typeof event.params.loaderId !== "string"
|
||||
)
|
||||
return;
|
||||
loaded.add(event.params.loaderId);
|
||||
if (event.params.loaderId === loaderId) resolveLoaded();
|
||||
});
|
||||
try {
|
||||
await connection.send("Page.setLifecycleEventsEnabled", { enabled: true });
|
||||
const navigation = await connection.send("Page.navigate", { url });
|
||||
assert.equal(navigation.errorText, undefined);
|
||||
assert.equal(typeof navigation.loaderId, "string");
|
||||
loaderId = navigation.loaderId;
|
||||
// A URL changes at commit, before old child frames have been retired.
|
||||
// Do not hand the shared page to the next verifier until this load ends.
|
||||
if (!loaded.has(loaderId))
|
||||
await raceWithTimeout(load, 10_000, () => {
|
||||
throw new Error(
|
||||
"External browser did not finish restoring its document",
|
||||
);
|
||||
});
|
||||
} finally {
|
||||
unsubscribe();
|
||||
await connection.send("Page.setLifecycleEventsEnabled", { enabled: false });
|
||||
}
|
||||
throw new Error("External browser did not return to its original URL");
|
||||
};
|
||||
@@ -218,6 +218,13 @@ export const providerCatalog = (sources) => {
|
||||
identity: sources.idaProvider.IDA_PROVIDER_IDENTITY,
|
||||
contracts: declaredContracts("ida", sources.idaProvider.IDA_OPERATIONS),
|
||||
},
|
||||
{
|
||||
identity: sources.kunaProvider.KUNA_PROVIDER_IDENTITY,
|
||||
contracts: declaredContracts(
|
||||
"kuna",
|
||||
sources.kunaProvider.KUNA_OPERATIONS,
|
||||
),
|
||||
},
|
||||
{
|
||||
identity: sources.nativeProvider.NATIVE_MACOS_PROVIDER_IDENTITY,
|
||||
contracts: sources.nativeContracts.NATIVE_TOOL_CONTRACTS,
|
||||
|
||||
@@ -109,6 +109,7 @@ const SOURCE_PATHS = {
|
||||
hopperProvider: "dist/hopper/HopperProviderCapabilities.js",
|
||||
ghidraProvider: "dist/ghidra/GhidraProviderCapabilities.js",
|
||||
idaProvider: "dist/ida/IdaProviderCapabilities.js",
|
||||
kunaProvider: "dist/kuna/KunaProviderCapabilities.js",
|
||||
nativeProvider: "dist/native/NativeMacOSProviderMetadata.js",
|
||||
artifactProviders: "dist/application/InvestigationProviders.js",
|
||||
browserIdentities: "dist/browser/providerIdentities.js",
|
||||
|
||||
@@ -18,13 +18,12 @@ export function writeWindowsGhidraByteSearchFixture(bytes) {
|
||||
export async function verifyWindowsGhidraByteSearch({
|
||||
invoke,
|
||||
sourceBytes,
|
||||
architecture,
|
||||
imageBase,
|
||||
sourceOwnedFixture = true,
|
||||
fallbackAddress,
|
||||
fallbackFileOffset,
|
||||
runCliPage,
|
||||
}) {
|
||||
const imageBase = architecture === "x86" ? 0x400000n : 0x140000000n;
|
||||
const query = sourceOwnedFixture
|
||||
? {
|
||||
pattern: WINDOWS_GHIDRA_BYTE_SEARCH_FIXTURE.pattern,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
export const WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES: readonly [
|
||||
"x86_64",
|
||||
"x86",
|
||||
"arm",
|
||||
"arm64",
|
||||
];
|
||||
export const WINDOWS_GHIDRA_FIXTURE_FLAGS: readonly string[];
|
||||
|
||||
/** Select one architecture without interpreting positional paths as flags. */
|
||||
export function windowsGhidraFixtureOptions(arguments_: readonly string[]): {
|
||||
architecture: (typeof WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES)[number];
|
||||
dll: boolean;
|
||||
pe32: boolean;
|
||||
imageBase: bigint;
|
||||
calleeRva: number;
|
||||
machine: number;
|
||||
filename: string;
|
||||
languageId: string;
|
||||
callerAddress: string;
|
||||
calleeAddress: string;
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
/** Source-owned PE fixtures; these are encoded bytes, not compiled programs. */
|
||||
/** @type {readonly ["x86_64", "x86", "arm", "arm64"]} */
|
||||
export const WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES = Object.freeze([
|
||||
"x86_64",
|
||||
"x86",
|
||||
"arm",
|
||||
"arm64",
|
||||
]);
|
||||
|
||||
export const WINDOWS_GHIDRA_FIXTURE_FLAGS = Object.freeze([
|
||||
"--x86",
|
||||
"--arm",
|
||||
"--arm64",
|
||||
"--dll",
|
||||
]);
|
||||
|
||||
/** Select one architecture without interpreting positional paths as flags. */
|
||||
/** @param {readonly string[]} arguments_ */
|
||||
export const windowsGhidraFixtureOptions = (arguments_) => {
|
||||
const selected = WINDOWS_GHIDRA_FIXTURE_ARCHITECTURES.filter(
|
||||
(architecture) =>
|
||||
architecture !== "x86_64" && arguments_.includes(`--${architecture}`),
|
||||
);
|
||||
if (selected.length > 1)
|
||||
throw new Error("Choose one Windows PE fixture architecture.");
|
||||
const architecture = selected[0] ?? "x86_64";
|
||||
const dll = arguments_.includes("--dll");
|
||||
const pe32 = architecture === "x86" || architecture === "arm";
|
||||
const imageBase = pe32 ? 0x400000n : 0x140000000n;
|
||||
const calleeRva = architecture.startsWith("arm") ? 0x1020 : 0x1010;
|
||||
return {
|
||||
architecture,
|
||||
dll,
|
||||
pe32,
|
||||
imageBase,
|
||||
calleeRva,
|
||||
machine: { x86: 0x14c, x86_64: 0x8664, arm: 0x1c4, arm64: 0xaa64 }[
|
||||
architecture
|
||||
],
|
||||
filename: `rea-ghidra-windows${architecture === "x86_64" ? "" : `-${architecture}`}.${dll ? "dll" : "exe"}`,
|
||||
languageId:
|
||||
architecture === "arm"
|
||||
? "ARM:LE:32:v8"
|
||||
: architecture === "arm64"
|
||||
? "AARCH64:LE:64:v8A"
|
||||
: `x86:LE:${pe32 ? 32 : 64}:default`,
|
||||
callerAddress: `0x${(imageBase + 0x1000n).toString(16)}`,
|
||||
calleeAddress: `0x${(imageBase + BigInt(calleeRva)).toString(16)}`,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { realpath } from "node:fs/promises";
|
||||
|
||||
import { runKunaCommand } from "../../dist/kuna/KunaCommand.js";
|
||||
import { inspectKunaInstallation } from "../../dist/kuna/KunaInstallation.js";
|
||||
import { KUNA_XREF_OUTPUT_BYTES } from "../../dist/kuna/KunaReferenceFiles.js";
|
||||
|
||||
/** Independent projection of native exact-target rows, bypassing REA's parser. */
|
||||
export const nativeKunaIncomingSites = async ({
|
||||
executable,
|
||||
cacheRoot,
|
||||
workspace,
|
||||
binary,
|
||||
address,
|
||||
retain,
|
||||
}) => {
|
||||
const installed = await inspectKunaInstallation({
|
||||
REA_KUNA_COMMAND: executable,
|
||||
REA_KUNA_CACHE_DIR: cacheRoot,
|
||||
});
|
||||
assert.ok(installed.ok, "Native reference oracle could not inspect Kuna");
|
||||
const input = await realpath(binary);
|
||||
const timeoutMs = installed.value.configuration.functionTimeoutMs;
|
||||
const outcome = await runKunaCommand({
|
||||
installation: installed.value,
|
||||
arguments: ["xrefs", input, "--to", address, "--json"],
|
||||
workspace,
|
||||
operation: "verify:kuna-native-xrefs",
|
||||
timeoutMs,
|
||||
reportedTimeoutMs: timeoutMs,
|
||||
outputBytes: KUNA_XREF_OUTPUT_BYTES,
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
if (outcome.kind === "retained") retain(outcome);
|
||||
if (outcome.kind !== "ok") throw outcome.error;
|
||||
const document = JSON.parse(outcome.snapshot.stdout.text);
|
||||
assert.equal(document.binary, input);
|
||||
assert.equal(document.direction, "to");
|
||||
assert.equal(document.target.address_hex, address);
|
||||
assert.equal(document.count, document.xrefs.length);
|
||||
const sites = document.xrefs
|
||||
.filter((row) => row.to_address_hex === address)
|
||||
.map((row) => row.from_address_hex);
|
||||
assert.ok(sites.every((site) => /^0x[0-9a-f]+$/u.test(site)));
|
||||
return [...new Set(sites)].sort();
|
||||
};
|
||||
@@ -0,0 +1,109 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readdir } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { combineFunctionRelationshipCoverage } from "../../dist/domain/functionCallCoverage.js";
|
||||
|
||||
const entries = async (path) => {
|
||||
try {
|
||||
return (await readdir(path)).sort();
|
||||
} catch (cause) {
|
||||
if (cause.code === "ENOENT") return [];
|
||||
throw cause;
|
||||
}
|
||||
};
|
||||
|
||||
/** Verify selected public reference answers without requesting source text. */
|
||||
export const verifyKunaReferences = async ({
|
||||
call,
|
||||
cacheRoot,
|
||||
name,
|
||||
address,
|
||||
expectedCaller,
|
||||
nativeIncoming,
|
||||
}) => {
|
||||
const before = await Promise.all([
|
||||
entries(join(cacheRoot, "projects")),
|
||||
entries(join(cacheRoot, "staging")),
|
||||
]);
|
||||
const callers = await call("procedure_callers", { procedure: address });
|
||||
const callees = await call("procedure_callees", { procedure: address });
|
||||
const incoming = await call("xrefs", { address });
|
||||
for (const [label, result] of [
|
||||
["callers", callers],
|
||||
["callees", callees],
|
||||
["xrefs", incoming],
|
||||
]) {
|
||||
assert.ok(
|
||||
Array.isArray(result.value),
|
||||
`${name} ${label} omitted its address list`,
|
||||
);
|
||||
assert.equal(
|
||||
new Set(result.value).size,
|
||||
result.value.length,
|
||||
`${label} repeats an address`,
|
||||
);
|
||||
assert.ok(
|
||||
result.value.every((value) =>
|
||||
/^0x(?:0|[1-9a-f][0-9a-f]{0,15})$/u.test(value),
|
||||
),
|
||||
`${label} returned a noncanonical u64 address`,
|
||||
);
|
||||
assert.equal(result.structured.provider.id, "kuna");
|
||||
const source = result.structured.raw_result.references;
|
||||
assert.match(source.sha256, /^[0-9a-f]{64}$/u);
|
||||
assert.ok(source.bytes > 0);
|
||||
}
|
||||
let composed;
|
||||
if (expectedCaller !== undefined) {
|
||||
assert.ok(
|
||||
callers.value.includes(expectedCaller),
|
||||
`${name} lost its source-owned caller`,
|
||||
);
|
||||
assert.ok(
|
||||
incoming.value.length > 0,
|
||||
`${name} lost its source-owned call site`,
|
||||
);
|
||||
assert.deepEqual(
|
||||
[...incoming.value].sort(),
|
||||
await nativeIncoming(address),
|
||||
`${name} incoming references differ from exact-target native sites`,
|
||||
);
|
||||
const graph = await call("get_call_graph", {
|
||||
address: expectedCaller,
|
||||
direction: "forward",
|
||||
});
|
||||
assert.ok(graph.value.graph["0"][0].calls.includes(address));
|
||||
const path = await call("trace_call_path", {
|
||||
start: expectedCaller,
|
||||
goal: address,
|
||||
direction: "forward",
|
||||
});
|
||||
assert.equal(path.value.goal_status, "reached");
|
||||
composed = { graph_ms: graph.ms, path_ms: path.ms };
|
||||
}
|
||||
assert.deepEqual(
|
||||
await Promise.all([
|
||||
entries(join(cacheRoot, "projects")),
|
||||
entries(join(cacheRoot, "staging")),
|
||||
]),
|
||||
before,
|
||||
"A reference-only workflow started a C project export",
|
||||
);
|
||||
const repeated = await call("procedure_callees", { procedure: address });
|
||||
assert.deepEqual(repeated.value, callees.value);
|
||||
return {
|
||||
callers: callers.value.length,
|
||||
callees: callees.value.length,
|
||||
xrefs: incoming.value.length,
|
||||
first_graph_ms: callers.ms,
|
||||
warm_graph_ms: repeated.ms,
|
||||
xrefs_ms: incoming.ms,
|
||||
response_bytes: callers.bytes + callees.bytes + incoming.bytes,
|
||||
relationship_coverage: combineFunctionRelationshipCoverage(
|
||||
callers.structured.relationship_coverage,
|
||||
callees.structured.relationship_coverage,
|
||||
),
|
||||
...composed,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,166 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readdir, realpath } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { runKunaCommand } from "../../dist/kuna/KunaCommand.js";
|
||||
import { inspectKunaInstallation } from "../../dist/kuna/KunaInstallation.js";
|
||||
|
||||
const entries = (path) =>
|
||||
readdir(path).catch((cause) => {
|
||||
if (cause.code === "ENOENT") return [];
|
||||
throw cause;
|
||||
});
|
||||
|
||||
/** Independent native oracle; uses source hex fields rather than JS numeric addresses. */
|
||||
export const nativeKunaStrings = async ({
|
||||
executable,
|
||||
cacheRoot,
|
||||
workspace,
|
||||
binary,
|
||||
retain,
|
||||
}) => {
|
||||
const installed = await inspectKunaInstallation({
|
||||
REA_KUNA_COMMAND: executable,
|
||||
REA_KUNA_CACHE_DIR: cacheRoot,
|
||||
});
|
||||
assert.ok(installed.ok, "Native string oracle could not inspect Kuna");
|
||||
const input = await realpath(binary);
|
||||
const outcome = await runKunaCommand({
|
||||
installation: installed.value,
|
||||
arguments: [
|
||||
"strings",
|
||||
input,
|
||||
"--json",
|
||||
"--encoding",
|
||||
"all",
|
||||
"--min-length",
|
||||
"5",
|
||||
"--termination",
|
||||
"any",
|
||||
"--no-xrefs",
|
||||
],
|
||||
workspace,
|
||||
operation: "verify:kuna-native-strings",
|
||||
timeoutMs: installed.value.configuration.projectTimeoutMs,
|
||||
reportedTimeoutMs: installed.value.configuration.projectTimeoutMs,
|
||||
outputBytes: 16 * 1024 * 1024,
|
||||
signal: new AbortController().signal,
|
||||
});
|
||||
if (outcome.kind === "retained") retain(outcome);
|
||||
if (outcome.kind !== "ok") throw outcome.error;
|
||||
const document = JSON.parse(outcome.snapshot.stdout.text);
|
||||
assert.equal(document.binary, input);
|
||||
assert.equal(document.count, document.strings.length);
|
||||
assert.equal(document.xrefs, false);
|
||||
return document.strings
|
||||
.map((row) => ({
|
||||
address: row.address_hex,
|
||||
value: row.text,
|
||||
string: {
|
||||
encoding: row.encoding,
|
||||
encoding_status: "observed",
|
||||
termination: row.nul_terminated ? "present_or_not_required" : "missing",
|
||||
byte_length: row.byte_length,
|
||||
},
|
||||
}))
|
||||
.sort((left, right) => {
|
||||
const a = BigInt(left.address),
|
||||
b = BigInt(right.address);
|
||||
return a < b
|
||||
? -1
|
||||
: a > b
|
||||
? 1
|
||||
: left.string.encoding.localeCompare(right.string.encoding, "en");
|
||||
});
|
||||
};
|
||||
|
||||
/** Verify focused/complete string operations before any procedure analysis starts. */
|
||||
export const verifyKunaStrings = async ({
|
||||
call,
|
||||
cacheRoot,
|
||||
nativeStrings,
|
||||
expectedStrings = [],
|
||||
}) => {
|
||||
const expected = await nativeStrings();
|
||||
if (expectedStrings.length > 0)
|
||||
assert.ok(
|
||||
expected.length > 0,
|
||||
"Source-owned string fixture did not exercise a positive result",
|
||||
);
|
||||
const pattern =
|
||||
expected.find(({ value }) => value.length >= 8 && value.length <= 100)
|
||||
?.value ??
|
||||
expected[0]?.value ??
|
||||
"REA-empty-string-inventory";
|
||||
const selected = expected.filter(({ value }) =>
|
||||
value.toLowerCase().includes(pattern.toLowerCase()),
|
||||
);
|
||||
const before = await Promise.all([
|
||||
entries(join(cacheRoot, "projects")),
|
||||
entries(join(cacheRoot, "staging")),
|
||||
]);
|
||||
const cold = await call("search_strings", { pattern });
|
||||
assert.deepEqual(
|
||||
cold.value,
|
||||
selected,
|
||||
"String search differs from native scan",
|
||||
);
|
||||
const source = cold.structured.raw_result.strings;
|
||||
assert.equal(source.inventory_count, expected.length);
|
||||
assert.equal(source.selected_count, selected.length);
|
||||
assert.equal(source.xrefs, false);
|
||||
assert.match(source.sha256, /^[0-9a-f]{64}$/u);
|
||||
assert.ok(source.bytes > 0);
|
||||
assert.equal(cold.structured.provider.id, "kuna");
|
||||
assert.ok(cold.structured.evidence_id);
|
||||
const complete = await call("list_strings");
|
||||
assert.deepEqual(complete.value, expected);
|
||||
for (const value of expectedStrings)
|
||||
assert.ok(
|
||||
complete.value.some((row) => row.value === value),
|
||||
`Required string ${JSON.stringify(value)} was not recovered`,
|
||||
);
|
||||
assert.equal(complete.structured.raw_result.strings.sha256, source.sha256);
|
||||
const repeated = await call("search_strings", { pattern });
|
||||
assert.deepEqual(repeated.value, selected);
|
||||
let exact;
|
||||
if (selected.length > 0) {
|
||||
const address = selected[0].address;
|
||||
exact = await call("list_strings", { address });
|
||||
assert.deepEqual(
|
||||
exact.value,
|
||||
expected.filter((item) => item.address === address),
|
||||
);
|
||||
}
|
||||
const regex = await call("search_strings", {
|
||||
pattern: "^.{5,12}$",
|
||||
mode: "regex",
|
||||
case_sensitive: true,
|
||||
});
|
||||
assert.deepEqual(
|
||||
regex.value,
|
||||
expected.filter(({ value }) => /^.{5,12}$/u.test(value)),
|
||||
);
|
||||
const missing = await call("search_strings", {
|
||||
pattern: "\u0000REA-negative-string-query\u0000",
|
||||
});
|
||||
assert.deepEqual(missing.value, []);
|
||||
assert.deepEqual(
|
||||
await Promise.all([
|
||||
entries(join(cacheRoot, "projects")),
|
||||
entries(join(cacheRoot, "staging")),
|
||||
]),
|
||||
before,
|
||||
"String reads started a project export",
|
||||
);
|
||||
return {
|
||||
inventory_count: expected.length,
|
||||
selected_count: selected.length,
|
||||
cold_scan_ms: cold.ms,
|
||||
warm_search_ms: repeated.ms,
|
||||
exact_address_ms: exact?.ms ?? null,
|
||||
cold_response_bytes: cold.bytes,
|
||||
complete_response_bytes: complete.bytes,
|
||||
regex_response_bytes: regex.bytes,
|
||||
};
|
||||
};
|
||||
@@ -146,6 +146,9 @@ async function verifySourceReadFailures({
|
||||
...(permissionDenied ? ["permission"] : []),
|
||||
];
|
||||
for (const scenario of scenarios) {
|
||||
// Same-target reopen may admit restored bytes through retained-client health.
|
||||
// Each rejection needs a cold client, without an existing private snapshot.
|
||||
await call("close_binary");
|
||||
await call("open_binary", { path: source, provider_id: "ghidra" });
|
||||
const before = await call("binary_session");
|
||||
if (scenario === "permission") await chmod(source, 0);
|
||||
|
||||
+41
-8
@@ -14,6 +14,10 @@ process.env.REA_PACKAGE_VERSION = packageJson.version;
|
||||
const isMcpMode =
|
||||
args.length === 1 && (args[0] === "--mcp" || args[0] === "mcp");
|
||||
const isMcpDoctorMode = args[0] === "mcp" && args[1] === "doctor";
|
||||
/** Exit status of a writer terminated by SIGPIPE (128 + 13). */
|
||||
const SIGPIPE_EXIT_STATUS = 141;
|
||||
// Set once the reader of CLI output has closed the pipe.
|
||||
let stdoutClosed = false;
|
||||
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
|
||||
// Windows home lookup throws for an empty USERPROFILE. Dependencies resolve
|
||||
@@ -55,13 +59,14 @@ if (!(await compiledRuntimeExists(runtimeFiles))) {
|
||||
const { runEntrypoint } = await import("../dist/mcp/main.js");
|
||||
await runEntrypoint();
|
||||
} else if (isMcpDoctorMode) {
|
||||
guardClosedStdout();
|
||||
const { runProductionMcpDoctorCli } =
|
||||
await import("../dist/cli-runtime/mcpDoctor.js");
|
||||
const result = await runProductionMcpDoctorCli(args.slice(2), {
|
||||
dispatcherPath: fileURLToPath(import.meta.url),
|
||||
packageRoot,
|
||||
});
|
||||
process.stdout.write(result.output);
|
||||
writeStdout(result.output);
|
||||
process.exitCode = result.exitCode;
|
||||
} else {
|
||||
const { cliConfigurationError, createCli } =
|
||||
@@ -69,36 +74,64 @@ if (!(await compiledRuntimeExists(runtimeFiles))) {
|
||||
const { createCliResultOutput } =
|
||||
await import("../dist/cli-runtime/cliResultOutput.js");
|
||||
const {
|
||||
normalizeCliOutputArguments,
|
||||
renderCliOutputArgumentError,
|
||||
renderEmptyFilteredCliOutput,
|
||||
validateCliOutputArguments,
|
||||
} = await import("../dist/cli-runtime/cliOutput.js");
|
||||
const outputArguments = validateCliOutputArguments(args);
|
||||
guardClosedStdout();
|
||||
const cliArgs = normalizeCliOutputArguments(args);
|
||||
const outputArguments = validateCliOutputArguments(cliArgs);
|
||||
const configurationError = cliConfigurationError(process.env);
|
||||
if (configurationError !== undefined) {
|
||||
process.stderr.write(`${configurationError}\n`);
|
||||
process.exitCode = 1;
|
||||
} else if (!outputArguments.ok) {
|
||||
process.stdout.write(renderCliOutputArgumentError(outputArguments));
|
||||
writeStdout(renderCliOutputArgumentError(outputArguments));
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
let wroteOutput = false;
|
||||
const resultOutput = createCliResultOutput(args, process.stdout);
|
||||
await createCli(process.env, resultOutput).serve(args, {
|
||||
const resultOutput = createCliResultOutput(cliArgs, process.stdout);
|
||||
await createCli(process.env, resultOutput).serve(cliArgs, {
|
||||
stdout: (output) => {
|
||||
if (resultOutput?.handled) {
|
||||
if (resultOutput.failed) process.stderr.write(output);
|
||||
if (resultOutput.failed && !stdoutClosed)
|
||||
process.stderr.write(output);
|
||||
return;
|
||||
}
|
||||
if (output.length > 0) wroteOutput = true;
|
||||
process.stdout.write(output);
|
||||
writeStdout(output);
|
||||
},
|
||||
// A command failure caused by the closed pipe keeps the pipe's status.
|
||||
exit: (code) => process.exit(stdoutClosed ? SIGPIPE_EXIT_STATUS : code),
|
||||
});
|
||||
if (!wroteOutput && !resultOutput?.handled)
|
||||
process.stdout.write(renderEmptyFilteredCliOutput(args) ?? "");
|
||||
writeStdout(renderEmptyFilteredCliOutput(cliArgs) ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A reader that closes the pipe early, as `rea ... | head` does, has declined
|
||||
* the rest of the output. Stop writing without reporting a failure, and exit
|
||||
* with the status a SIGPIPE-terminated writer reports. MCP stdio keeps its own
|
||||
* client lifecycle.
|
||||
*/
|
||||
function guardClosedStdout() {
|
||||
process.stdout.on("error", (cause) => {
|
||||
if (cause?.code === "EPIPE") {
|
||||
stdoutClosed = true;
|
||||
process.exitCode = SIGPIPE_EXIT_STATUS;
|
||||
return;
|
||||
}
|
||||
// Other failures stay unhandled unless a pending JSON write reports them.
|
||||
if (process.stdout.listenerCount("error") === 1) throw cause;
|
||||
});
|
||||
}
|
||||
|
||||
function writeStdout(output) {
|
||||
if (!stdoutClosed) process.stdout.write(output);
|
||||
}
|
||||
|
||||
async function compiledRuntimeExists(paths) {
|
||||
for (const path of paths) {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
|
||||
// Record the default catalog digests into the compiled runtime. Run after
|
||||
// `tsc` and before bundling, so the digests come from the same compiled
|
||||
// contracts and pinned schema converter that the runtime serves.
|
||||
const compiledRoot = resolve(
|
||||
dirname(fileURLToPath(import.meta.url)),
|
||||
"../dist",
|
||||
);
|
||||
const { createCatalogDigests } = await import(
|
||||
pathToFileURL(join(compiledRoot, "catalogIdentity.js")).href
|
||||
);
|
||||
await writeFile(
|
||||
join(compiledRoot, "recordedCatalogDigests.js"),
|
||||
`/** Recorded from the compiled default catalog by scripts/record-catalog-digests.mjs; do not edit. */\nexport const RECORDED_CATALOG_DIGESTS = Object.freeze(${JSON.stringify(createCatalogDigests())});\n`,
|
||||
"utf8",
|
||||
);
|
||||
@@ -13,6 +13,7 @@ import { promisify } from "node:util";
|
||||
|
||||
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
|
||||
import { assertCleanLinuxHopperRuntime } from "./lib/clean-linux-hopper-runtime.mjs";
|
||||
import { isUnsupportedHopperLaunchFailure } from "./verify-package-platform.mjs";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const verifierRun = createVerifierRun();
|
||||
@@ -89,16 +90,24 @@ try {
|
||||
await appendFile(modifiedHopper, new Uint8Array([0]));
|
||||
await chmod(modifiedHopper, 0o700);
|
||||
try {
|
||||
await execFileAsync(command, ["analyze", "/usr/bin/true"], {
|
||||
env: { ...process.env, HOPPER_LAUNCHER_PATH: modifiedHopper },
|
||||
timeout: 30_000,
|
||||
});
|
||||
await execFileAsync(
|
||||
command,
|
||||
["analyze", "/usr/bin/true", "--provider", "hopper", "--json"],
|
||||
{
|
||||
env: { ...process.env, HOPPER_LAUNCHER_PATH: modifiedHopper },
|
||||
timeout: 30_000,
|
||||
},
|
||||
);
|
||||
throw new Error("modified Hopper build was not rejected");
|
||||
} catch (error) {
|
||||
const output = `${error?.stdout ?? ""}\n${error?.stderr ?? ""}`;
|
||||
if (!output.includes("unsupported_hopper_build"))
|
||||
if (
|
||||
error?.code !== 1 ||
|
||||
typeof error.stdout !== "string" ||
|
||||
!isUnsupportedHopperLaunchFailure(JSON.parse(error.stdout))
|
||||
)
|
||||
throw new Error(
|
||||
"modified Hopper build did not return its stable failure code",
|
||||
{ cause: error },
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { chmod, mkdir, symlink, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { supportedClients } from "../dist/application/SupportedClients.js";
|
||||
|
||||
/** Create an isolated prefix, fake PATH, client configs, and environment. */
|
||||
@@ -121,6 +122,14 @@ export const packageHopperEnvironment = (root, platform = process.platform) => {
|
||||
};
|
||||
return {
|
||||
HOPPER_LAUNCHER_PATH: "/bin/sh",
|
||||
// Feed availability must not turn this foreign-launcher rejection test into
|
||||
// an unrelated networking failure. Successful vendor verification is real E2E coverage.
|
||||
NODE_OPTIONS: [
|
||||
process.env.NODE_OPTIONS,
|
||||
`--import=${pathToFileURL(join(root, "tests/fixtures/hopperRejectionFeed.mjs")).href}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" "),
|
||||
HOPPER_LOADER_ARGS_JSON: JSON.stringify([
|
||||
"-c",
|
||||
'node_path=$1; shift; "$node_path" "$@"',
|
||||
|
||||
@@ -88,14 +88,29 @@ export async function verifyPackagePlatform({
|
||||
}
|
||||
}
|
||||
|
||||
/** Require the declared unsupported build or an exact missing-Xvfb diagnostic, never arbitrary provider failure. */
|
||||
/** One owner for unsupported-launch evidence across package and real-Hopper verification. */
|
||||
export const isUnsupportedHopperLaunchFailure = (failure) => {
|
||||
const details = failure?.details;
|
||||
const unsupportedBuild =
|
||||
details?.failure_code === "unsupported_hopper_build" &&
|
||||
details.exit_code === 72;
|
||||
const publisherRejection =
|
||||
details?.stage === "launch" &&
|
||||
details.launch_rejection?.boundary === "publisher_verification" &&
|
||||
details.launch_rejection.reason === "unsupported_hopper_build" &&
|
||||
details.exit_code === undefined &&
|
||||
details.launcher === undefined;
|
||||
return (
|
||||
failure?.code === "provider_unavailable" &&
|
||||
(publisherRejection || unsupportedBuild)
|
||||
);
|
||||
};
|
||||
|
||||
/** Require an exact pre-execution rejection, observed helper exit, or missing-Xvfb diagnostic. */
|
||||
export const assertLinuxPackageProviderFailure = (execution) => {
|
||||
const failure = json(execution.stdout);
|
||||
const details = failure?.details;
|
||||
const diagnostic = details?.diagnostics;
|
||||
const unsupportedBuild =
|
||||
details?.failure_code === "unsupported_hopper_build" &&
|
||||
details.exit_code === 72;
|
||||
const missingDisplayDependency =
|
||||
details?.failure_code === "runtime_dependency_unavailable" &&
|
||||
details.exit_code === 79 &&
|
||||
@@ -108,7 +123,7 @@ export const assertLinuxPackageProviderFailure = (execution) => {
|
||||
if (
|
||||
execution.status !== 1 ||
|
||||
failure?.code !== "provider_unavailable" ||
|
||||
(!unsupportedBuild && !missingDisplayDependency)
|
||||
(!isUnsupportedHopperLaunchFailure(failure) && !missingDisplayDependency)
|
||||
)
|
||||
throw new Error(
|
||||
`packaged Linux Hopper verification did not fail closed: ${JSON.stringify(failure)}`,
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
import {
|
||||
WINDOWS_GHIDRA_FIXTURE_FLAGS,
|
||||
windowsGhidraFixtureOptions,
|
||||
} from "./lib/ghidra-windows-fixture-options.mjs";
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
@@ -33,11 +37,11 @@ const exec = promisify(execFile);
|
||||
const arguments_ = process.argv.slice(2);
|
||||
const internalWorkspace = arguments_[0] === "--internal-workspace";
|
||||
const fixtureArguments = internalWorkspace ? arguments_.slice(2) : arguments_;
|
||||
const x86Fixture = fixtureArguments.includes("--x86");
|
||||
const dllFixture = fixtureArguments.includes("--dll");
|
||||
const fixture = windowsGhidraFixtureOptions(fixtureArguments);
|
||||
const dllFixture = fixture.dll;
|
||||
const [packageRootArgument, targetArgument, reportArgument] =
|
||||
fixtureArguments.filter(
|
||||
(argument) => argument !== "--x86" && argument !== "--dll",
|
||||
(argument) => !WINDOWS_GHIDRA_FIXTURE_FLAGS.includes(argument),
|
||||
);
|
||||
// Windows locks the loaded package-owned addon until the verifier exits.
|
||||
// Keep installation cleanup in a parent that never loads that addon.
|
||||
@@ -125,10 +129,7 @@ if (packageRootArgument === undefined) {
|
||||
});
|
||||
}
|
||||
}
|
||||
const target = resolve(
|
||||
targetArgument ??
|
||||
`build/fixtures/rea-ghidra-windows${x86Fixture ? "-x86" : ""}.${dllFixture ? "dll" : "exe"}`,
|
||||
);
|
||||
const target = resolve(targetArgument ?? `build/fixtures/${fixture.filename}`);
|
||||
let TOOL_CONTRACTS, native, token, sha256;
|
||||
let parsedTarget;
|
||||
try {
|
||||
@@ -160,10 +161,7 @@ try {
|
||||
assert.equal(parsedTarget.value.format, "pe");
|
||||
assert.equal(parsedTarget.value.managed, false);
|
||||
if (targetArgument === undefined) {
|
||||
assert.equal(
|
||||
parsedTarget.value.architecture,
|
||||
x86Fixture ? "x86" : "x86_64",
|
||||
);
|
||||
assert.equal(parsedTarget.value.architecture, fixture.architecture);
|
||||
assert.equal(
|
||||
parsedTarget.value.executableRole,
|
||||
dllFixture ? "shared-library" : "application",
|
||||
@@ -321,13 +319,13 @@ try {
|
||||
const procedures = await call("list_procedures", {});
|
||||
assert.ok(procedures.length > 0);
|
||||
if (targetArgument === undefined) {
|
||||
const calleeAddress = x86Fixture ? "0x401010" : "0x140001010";
|
||||
const calleeAddress = fixture.calleeAddress;
|
||||
const calleeCode = await call("procedure_pseudo_code", {
|
||||
procedure: calleeAddress,
|
||||
});
|
||||
assert.match(calleeCode, /\b(?:42|0x2a)\b/iu);
|
||||
if (dllFixture) {
|
||||
const callerAddress = x86Fixture ? "0x401000" : "0x140001000";
|
||||
const callerAddress = fixture.callerAddress;
|
||||
assert.ok(
|
||||
(
|
||||
await call("procedure_callees", { procedure: callerAddress })
|
||||
@@ -379,7 +377,7 @@ try {
|
||||
report.byteSearch = await verifyWindowsGhidraByteSearch({
|
||||
invoke: call,
|
||||
sourceBytes,
|
||||
architecture: parsedTarget.value.architecture,
|
||||
imageBase: fixture.imageBase,
|
||||
sourceOwnedFixture: targetArgument === undefined,
|
||||
fallbackAddress: procedure.address,
|
||||
fallbackFileOffset: mapping.file_offset,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
import { windowsGhidraFixtureOptions } from "./lib/ghidra-windows-fixture-options.mjs";
|
||||
|
||||
import { access, readFile } from "node:fs/promises";
|
||||
import { isAbsolute, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { parseConfig } from "../dist/config/parseConfig.js";
|
||||
import { resolveGhidraAnalysisProfile } from "../dist/ghidra/GhidraAnalysisProfile.js";
|
||||
import { GhidraClient } from "../dist/ghidra/GhidraClient.js";
|
||||
import {
|
||||
@@ -20,7 +22,10 @@ import { inspectGhidraInstallation } from "../dist/ghidra/GhidraInstallation.js"
|
||||
import { SUPPORTED_GHIDRA_VERSION } from "../dist/ghidra/GhidraInstallationPolicy.js";
|
||||
import { GhidraHeadlessLauncher } from "../dist/ghidra/GhidraLauncher.js";
|
||||
import { GHIDRA_PROVIDER_IDENTITY } from "../dist/ghidra/GhidraProviderCapabilities.js";
|
||||
import { windowsP0Capabilities } from "../dist/ghidra/GhidraProviderCapabilities.js";
|
||||
import {
|
||||
WINDOWS_P0_NATIVE_PE_ARCHITECTURES,
|
||||
windowsP0Capabilities,
|
||||
} from "../dist/ghidra/GhidraProviderCapabilities.js";
|
||||
import {
|
||||
GHIDRA_MUTATING_OPERATIONS,
|
||||
GHIDRA_SESSION_CAPABILITIES,
|
||||
@@ -71,15 +76,11 @@ if (
|
||||
);
|
||||
|
||||
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
|
||||
const architecture = process.argv.includes("--x86") ? "x86" : "x86_64";
|
||||
const dllFixture = process.argv.includes("--dll");
|
||||
const fixture = windowsGhidraFixtureOptions(process.argv.slice(2));
|
||||
const architecture = fixture.architecture;
|
||||
const dllFixture = fixture.dll;
|
||||
const role = dllFixture ? "shared-library" : "application";
|
||||
const targetPath = resolve(
|
||||
root,
|
||||
"build",
|
||||
"fixtures",
|
||||
`rea-ghidra-windows${architecture === "x86" ? "-x86" : ""}.${dllFixture ? "dll" : "exe"}`,
|
||||
);
|
||||
const targetPath = resolve(root, "build", "fixtures", fixture.filename);
|
||||
const target = await parseBinaryTarget(targetPath);
|
||||
if (
|
||||
!target.ok ||
|
||||
@@ -91,10 +92,15 @@ if (
|
||||
throw new Error(
|
||||
`Controlled Windows fixture failed admission: ${JSON.stringify(target)}`,
|
||||
);
|
||||
const configuration = parseConfig(process.env);
|
||||
if (!configuration.ok) throw configuration.error;
|
||||
const profile = await resolveGhidraAnalysisProfile(
|
||||
target.value,
|
||||
GHIDRA_PROVIDER_IDENTITY,
|
||||
installation,
|
||||
undefined,
|
||||
undefined,
|
||||
configuration.value.ghidraDisabledAnalyzers,
|
||||
);
|
||||
if (!profile.ok || profile.value.profile === null)
|
||||
throw new Error("Windows Ghidra profile could not be committed");
|
||||
@@ -113,6 +119,9 @@ const client = new GhidraClient({
|
||||
new URL("../bridge/ghidra/ReaGhidraBridge.java", import.meta.url),
|
||||
),
|
||||
platform: "win32",
|
||||
...(configuration.value.ghidraDisabledAnalyzers === undefined
|
||||
? {}
|
||||
: { disabledAnalyzers: configuration.value.ghidraDisabledAnalyzers }),
|
||||
}),
|
||||
targetPath: target.value.path,
|
||||
targetSha256: target.value.sha256,
|
||||
@@ -134,8 +143,8 @@ try {
|
||||
target.value.sha256,
|
||||
profile.value.profile.digest,
|
||||
);
|
||||
const languagePrefix = architecture === "x86" ? "x86:LE:32:" : "x86:LE:64:";
|
||||
if (!started.value.target.language_id.startsWith(languagePrefix))
|
||||
const languageId = fixture.languageId;
|
||||
if (started.value.target.language_id !== languageId)
|
||||
throw new Error("Windows fixture imported with the wrong Ghidra language");
|
||||
coordinates = client.diagnostics();
|
||||
assertRuntimeCoordinates(coordinates, target.value.sha256);
|
||||
@@ -161,7 +170,7 @@ try {
|
||||
);
|
||||
if (procedure === undefined)
|
||||
throw new Error("Windows Ghidra fixture exposed no local procedure");
|
||||
const calleeAddress = architecture === "x86" ? 0x401010n : 0x140001010n;
|
||||
const calleeAddress = BigInt(fixture.calleeAddress);
|
||||
const callee = procedures.find(
|
||||
(item) => BigInt(item.address) === calleeAddress,
|
||||
);
|
||||
@@ -175,7 +184,7 @@ try {
|
||||
"Windows fixture decompilation lost its known return value",
|
||||
);
|
||||
if (dllFixture) {
|
||||
const callerAddress = architecture === "x86" ? "0x401000" : "0x140001000";
|
||||
const callerAddress = fixture.callerAddress;
|
||||
const callees = await functionOperation("procedure_callees", {
|
||||
procedure: callerAddress,
|
||||
});
|
||||
@@ -223,7 +232,7 @@ try {
|
||||
const byteSearch = await verifyWindowsGhidraByteSearch({
|
||||
invoke: inventory,
|
||||
sourceBytes,
|
||||
architecture,
|
||||
imageBase: fixture.imageBase,
|
||||
});
|
||||
|
||||
for (const operation of [
|
||||
@@ -268,12 +277,16 @@ try {
|
||||
|
||||
// The reference controls occupy the EXE fixture's additional function.
|
||||
// DLL fixtures retain their independent exported-caller/return controls.
|
||||
const compactReferences = dllFixture
|
||||
? null
|
||||
: await verifyGhidraCompactReferences(
|
||||
functionOperation,
|
||||
architecture === "x86",
|
||||
);
|
||||
// ARM/ARM64 fixtures verify function entry, decompiler readback and the
|
||||
// exported caller/callee relationship; the x86/x64 compact-reference
|
||||
// value-flow battery has no ARM/ARM64 instruction encoding in this fixture.
|
||||
const compactReferences =
|
||||
dllFixture || architecture === "arm" || architecture === "arm64"
|
||||
? null
|
||||
: await verifyGhidraCompactReferences(
|
||||
functionOperation,
|
||||
architecture === "x86",
|
||||
);
|
||||
const borlandSeh =
|
||||
architecture === "x86" && !dllFixture
|
||||
? await verifyGhidraBorlandSeh(functionObservationOperation, true)
|
||||
@@ -300,10 +313,11 @@ try {
|
||||
protected_dacl: true,
|
||||
handle_admission: true,
|
||||
},
|
||||
supported_target_architectures: [...WINDOWS_P0_NATIVE_PE_ARCHITECTURES],
|
||||
limitations: [
|
||||
"approved-non-sensitive-fixtures-only",
|
||||
"windows-x64-local-ntfs-only",
|
||||
"native-x86-and-x86-64-pe-applications-and-dlls-only",
|
||||
"native-pe-applications-and-dlls-only",
|
||||
"no-gui-or-mutation-authority",
|
||||
],
|
||||
};
|
||||
@@ -323,11 +337,24 @@ try {
|
||||
}
|
||||
if (report === undefined)
|
||||
throw new Error("Windows Ghidra report was not produced");
|
||||
report.file_offsets = await verifyGhidraFileOffsets(
|
||||
targetPath,
|
||||
resolve(root, "scripts", "rea.mjs"),
|
||||
architecture === "x86" ? "0x401010" : "0x140001010",
|
||||
);
|
||||
try {
|
||||
report.file_offsets = await verifyGhidraFileOffsets(
|
||||
targetPath,
|
||||
resolve(root, "scripts", "rea.mjs"),
|
||||
fixture.calleeAddress,
|
||||
);
|
||||
} catch (cause) {
|
||||
// Preserve completed real-provider facts if a separate adapter proof fails.
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
...report,
|
||||
ok: false,
|
||||
primary_verification: "complete",
|
||||
file_offsets: { status: "incomplete", failure_code: cause.code ?? null },
|
||||
})}\n`,
|
||||
);
|
||||
throw cause;
|
||||
}
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({ verifier_run: await completeVerifierRun(verifierRun), ...report })}\n`,
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
requireMcpOperationResult,
|
||||
} from "./lib/mcp-verifier-results.mjs";
|
||||
import { snapshotHopperRuntime } from "./lib/real-hopper-cleanup.mjs";
|
||||
import { HOPPER_TARGET_LEASE_DIRECTORY } from "../dist/hopper/HopperTargetLease.js";
|
||||
import { HOPPER_TARGET_LEASE_DIRECTORY } from "../dist/process/HopperLease.js";
|
||||
import { parseConfig } from "../dist/config/parseConfig.js";
|
||||
import {
|
||||
verifyHopperSourceBinding,
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
requirePseudocode,
|
||||
} from "../dist/application/RealHopperAssertions.js";
|
||||
import { HOPPER_PROVIDER_IDENTITY } from "../dist/hopper/HopperProviderCapabilities.js";
|
||||
import { HOPPER_TARGET_LEASE_DIRECTORY } from "../dist/hopper/HopperTargetLease.js";
|
||||
import { HOPPER_TARGET_LEASE_DIRECTORY } from "../dist/process/HopperLease.js";
|
||||
import { REA_WORKFLOW_PROVIDER } from "../dist/application/InvestigationProviders.js";
|
||||
import { loadRealHopperFixtureTargets } from "./lib/real-hopper-fixture.mjs";
|
||||
import { verifyHopperStringObjects } from "./lib/real-hopper-search.mjs";
|
||||
|
||||
@@ -0,0 +1,599 @@
|
||||
#!/usr/bin/env node
|
||||
// Real Kuna provider lane. Requires a caller-supplied kuna (REA_KUNA_COMMAND)
|
||||
// and a host C compiler; REA installs neither. The default run builds a
|
||||
// source-owned fixture, with symbols and stripped, and verifies the public MCP
|
||||
// workflow: cold single-function pseudocode, the project export, warm reuse
|
||||
// from a fresh server, and cleanup. `--targets DIR --functions a,b` adds
|
||||
// caller-built binaries (DIR/<flavor>/<name> plus <name>.stripped).
|
||||
// `--compare-ghidra` runs the same functions through a bring-your-own Ghidra
|
||||
// and reports latency, CPU, memory, output size and simple quality signals.
|
||||
import assert from "node:assert/strict";
|
||||
import { execFile } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import {
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
readdir,
|
||||
rm,
|
||||
stat,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { parseArgs, promisify } from "node:util";
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { execFileOutput } from "../dist/process/ExecFileOutput.js";
|
||||
import { requireMcpOperationResult } from "./lib/mcp-verifier-results.mjs";
|
||||
import { verifyKunaReferences } from "./lib/kuna-reference-verifier.mjs";
|
||||
import {
|
||||
nativeKunaStrings,
|
||||
verifyKunaStrings,
|
||||
} from "./lib/kuna-string-verifier.mjs";
|
||||
import { nativeKunaIncomingSites } from "./lib/kuna-native-reference-verifier.mjs";
|
||||
import {
|
||||
assertVerifierCleanupComplete,
|
||||
completeVerifierRun,
|
||||
createVerifierRun,
|
||||
} from "./lib/verifier-run.mjs";
|
||||
|
||||
const exec = promisify(execFile);
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
targets: { type: "string" },
|
||||
functions: { type: "string" },
|
||||
"compare-ghidra": { type: "boolean", default: false },
|
||||
report: { type: "string" },
|
||||
entrypoint: { type: "string" },
|
||||
},
|
||||
});
|
||||
const entrypoint =
|
||||
values.entrypoint === undefined
|
||||
? fileURLToPath(new URL("./rea.mjs", import.meta.url))
|
||||
: resolve(values.entrypoint);
|
||||
const kuna = process.env.REA_KUNA_COMMAND;
|
||||
assert.ok(
|
||||
kuna !== undefined && kuna.startsWith("/"),
|
||||
"Kuna lane prerequisite missing: REA_KUNA_COMMAND must name a caller-supplied kuna by absolute path (bring your own)",
|
||||
);
|
||||
if (values["compare-ghidra"]) {
|
||||
// The comparison runs on caller-built targets only; the fixture has none.
|
||||
assert.ok(
|
||||
values.targets !== undefined && values.functions !== undefined,
|
||||
"--compare-ghidra compares caller-built targets: pass --targets DIR --functions a,b as well",
|
||||
);
|
||||
assert.ok(
|
||||
process.env.GHIDRA_INSTALL_DIR,
|
||||
"Ghidra comparison prerequisite missing: GHIDRA_INSTALL_DIR (bring your own Ghidra 12.1.4 and JDK 21)",
|
||||
);
|
||||
}
|
||||
const run = createVerifierRun();
|
||||
const workspace = await mkdtemp(join(tmpdir(), "rea-kuna-lane-"));
|
||||
const cacheRoot = join(workspace, "cache");
|
||||
// A server retains its workspace until both provider and transport cleanup
|
||||
// have positively completed, even if later lineage observation is empty.
|
||||
const pendingServers = new Set();
|
||||
// Unproven native-oracle stops retain their supervisors and this workspace.
|
||||
const retainedNative = new Set();
|
||||
let kunaVersion;
|
||||
|
||||
const FIXTURE_SOURCE = String.raw`
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
static const char rea_kuna_utf8[] __attribute__((used)) = "_φ( °-°)/ REA unicode marker";
|
||||
static const unsigned short rea_kuna_wide[] __attribute__((used)) = {
|
||||
'R','E','A',' ','w','i','d','e',' ','m','a','r','k','e','r',0
|
||||
};
|
||||
#include <string.h>
|
||||
__attribute__((noinline)) unsigned rea_checksum(const unsigned char *p, size_t n) {
|
||||
unsigned h = 2166136261u;
|
||||
for (size_t i = 0; i < n; i++) h = (h ^ p[i]) * 16777619u;
|
||||
return h;
|
||||
}
|
||||
__attribute__((noinline)) int rea_classify(int c) {
|
||||
switch (c) {
|
||||
case 'a': return 1; case 'e': return 2; case 'i': return 3;
|
||||
case 'o': return 4; case 'u': return 5; default: return c > 'z' ? -1 : 0;
|
||||
}
|
||||
}
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) return 2;
|
||||
printf("%u %d\n", rea_checksum((const unsigned char *)argv[1], strlen(argv[1])),
|
||||
rea_classify(argv[1][0]));
|
||||
return 0;
|
||||
}
|
||||
`;
|
||||
|
||||
/** Resolve function entry addresses from a symbol-bearing build. */
|
||||
const symbolAddresses = async (binary, names) => {
|
||||
const { stdout } = await exec(process.env.REA_NM ?? "nm", [binary]);
|
||||
const found = new Map();
|
||||
for (const line of stdout.split("\n")) {
|
||||
const [address, type, symbol] = line.trim().split(/\s+/u);
|
||||
if (symbol === undefined || !/^[tT]$/u.test(type ?? "")) continue;
|
||||
const plain = symbol.startsWith("_") ? symbol.slice(1) : symbol;
|
||||
for (const name of names)
|
||||
if ((symbol === name || plain === name) && !found.has(name))
|
||||
found.set(name, `0x${BigInt(`0x${address}`).toString(16)}`);
|
||||
}
|
||||
return found;
|
||||
};
|
||||
|
||||
/** Sum the resident memory and CPU time of a process and its descendants. */
|
||||
const sampleTree = async (root) => {
|
||||
const { stdout } = await exec("ps", ["-A", "-o", "pid=,ppid=,rss=,time="]);
|
||||
const rows = stdout
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map((line) => line.trim().split(/\s+/u))
|
||||
.map(([pid, ppid, rss, time]) => ({
|
||||
pid: Number(pid),
|
||||
ppid: Number(ppid),
|
||||
rssKiB: Number(rss),
|
||||
cpuSeconds: (time ?? "0:0")
|
||||
.split(/[:-]/u)
|
||||
.map(Number)
|
||||
.reduce((total, part) => total * 60 + part, 0),
|
||||
}));
|
||||
const members = new Set([root]);
|
||||
for (let grew = true; grew;) {
|
||||
grew = false;
|
||||
for (const row of rows)
|
||||
if (!members.has(row.pid) && members.has(row.ppid)) {
|
||||
members.add(row.pid);
|
||||
grew = true;
|
||||
}
|
||||
}
|
||||
const tree = rows.filter(({ pid }) => members.has(pid));
|
||||
return {
|
||||
rssKiB: tree.reduce((total, row) => total + row.rssKiB, 0),
|
||||
cpu: new Map(tree.map((row) => [row.pid, row.cpuSeconds])),
|
||||
};
|
||||
};
|
||||
|
||||
/** One MCP server with a selected provider, sampled while it runs. */
|
||||
const openServer = async (provider) => {
|
||||
const owner = Symbol(provider.id);
|
||||
pendingServers.add(owner);
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
args: [entrypoint, "--mcp"],
|
||||
env: {
|
||||
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
||||
HOME: process.env.HOME ?? workspace,
|
||||
REA_LOG_LEVEL: "silent",
|
||||
REA_PROCESS_RUN_ID: run.run_id,
|
||||
REA_KUNA_COMMAND: kuna,
|
||||
REA_KUNA_CACHE_DIR: cacheRoot,
|
||||
...(process.env.GHIDRA_INSTALL_DIR === undefined
|
||||
? {}
|
||||
: { GHIDRA_INSTALL_DIR: process.env.GHIDRA_INSTALL_DIR }),
|
||||
...(process.env.JAVA_HOME === undefined
|
||||
? {}
|
||||
: { JAVA_HOME: process.env.JAVA_HOME }),
|
||||
},
|
||||
stderr: "ignore",
|
||||
});
|
||||
const client = new Client({ name: "rea-real-kuna", version: "1" });
|
||||
let peakKiB = 0;
|
||||
const cpu = new Map();
|
||||
const sampleOnce = async () => {
|
||||
const pid = transport.pid;
|
||||
if (pid === null) return;
|
||||
const observed = await sampleTree(pid).catch(() => undefined);
|
||||
if (observed === undefined) return;
|
||||
peakKiB = Math.max(peakKiB, observed.rssKiB);
|
||||
for (const [member, seconds] of observed.cpu)
|
||||
cpu.set(member, Math.max(cpu.get(member) ?? 0, seconds));
|
||||
};
|
||||
let sampling;
|
||||
const sample = () => {
|
||||
sampling ??= sampleOnce().finally(() => {
|
||||
sampling = undefined;
|
||||
});
|
||||
return sampling;
|
||||
};
|
||||
let timer;
|
||||
const call = async (name, arguments_ = {}) => {
|
||||
const started = performance.now();
|
||||
const result = await client.callTool(
|
||||
{ name, arguments: arguments_ },
|
||||
{ timeout: 3_600_000 },
|
||||
);
|
||||
const ms = Math.round(performance.now() - started);
|
||||
const bytes = Buffer.byteLength(JSON.stringify(result));
|
||||
return {
|
||||
ms,
|
||||
bytes,
|
||||
value: requireMcpOperationResult(result, name),
|
||||
structured: result.structuredContent,
|
||||
};
|
||||
};
|
||||
const close = async (priorFailure) => {
|
||||
clearInterval(timer);
|
||||
await sample();
|
||||
const failures = priorFailure === undefined ? [] : [priorFailure];
|
||||
// Attempt each cleanup independently. Disposing a transport is not proof
|
||||
// that close_binary released retained provider processes or files.
|
||||
for (const cleanup of [
|
||||
() => call("close_binary"),
|
||||
() => client.close(),
|
||||
() => transport.close(),
|
||||
])
|
||||
try {
|
||||
await cleanup();
|
||||
} catch (cause) {
|
||||
failures.push(cause);
|
||||
}
|
||||
// A prior verification error must survive successful cleanup. Only the
|
||||
// cleanup failures retain this server's files.
|
||||
if (failures.length > (priorFailure === undefined ? 0 : 1))
|
||||
throw new AggregateError(
|
||||
failures,
|
||||
"MCP server cleanup was not confirmed",
|
||||
);
|
||||
pendingServers.delete(owner);
|
||||
if (priorFailure !== undefined) throw priorFailure;
|
||||
return {
|
||||
peak_rss_mib: Math.round(peakKiB / 1024),
|
||||
cpu_seconds: [...cpu.values()].reduce((total, value) => total + value, 0),
|
||||
};
|
||||
};
|
||||
try {
|
||||
await client.connect(transport);
|
||||
timer = setInterval(() => void sample(), 200);
|
||||
await call("open_binary", {
|
||||
path: provider.path,
|
||||
provider_id: provider.id,
|
||||
});
|
||||
} catch (cause) {
|
||||
// A rejected connection/target still owns its transport and workspace.
|
||||
await close(cause);
|
||||
}
|
||||
return { call, close };
|
||||
};
|
||||
|
||||
/** Count structuring and diagnostic markers in provider pseudocode. */
|
||||
const quality = (text) => ({
|
||||
bytes: text === null ? 0 : Buffer.byteLength(text),
|
||||
gotos: text === null ? 0 : (text.match(/\bgoto\b/gu) ?? []).length,
|
||||
warnings:
|
||||
text === null ? 0 : (text.match(/WARNING|\/\/ warn:/gu) ?? []).length,
|
||||
});
|
||||
|
||||
/** Verify Kuna on one binary and measure its cold and warm answers. */
|
||||
const verifyKuna = async (
|
||||
path,
|
||||
functions,
|
||||
expectedCaller,
|
||||
expectedStrings = [],
|
||||
) => {
|
||||
const sha256 = createHash("sha256")
|
||||
.update(await readFile(path))
|
||||
.digest("hex");
|
||||
const cold = await openServer({ path, id: "kuna" });
|
||||
const answers = [];
|
||||
let coldFailure;
|
||||
try {
|
||||
answers.push({
|
||||
strings: await verifyKunaStrings({
|
||||
call: cold.call,
|
||||
cacheRoot,
|
||||
expectedStrings,
|
||||
nativeStrings: () =>
|
||||
nativeKunaStrings({
|
||||
executable: kuna,
|
||||
cacheRoot,
|
||||
workspace,
|
||||
binary: path,
|
||||
retain: (owner) => retainedNative.add(owner),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
const listed = await cold.call("list_procedures");
|
||||
for (const [name, address] of functions) {
|
||||
assert.ok(
|
||||
listed.value.some((entry) => entry.address === address),
|
||||
`${name} at ${address} is missing from Kuna's procedure list for ${path}`,
|
||||
);
|
||||
const references = await verifyKunaReferences({
|
||||
call: cold.call,
|
||||
cacheRoot,
|
||||
name,
|
||||
address,
|
||||
expectedCaller,
|
||||
nativeIncoming: (targetAddress) =>
|
||||
nativeKunaIncomingSites({
|
||||
executable: kuna,
|
||||
cacheRoot,
|
||||
workspace,
|
||||
binary: path,
|
||||
address: targetAddress,
|
||||
retain: (outcome) => retainedNative.add(outcome),
|
||||
}),
|
||||
});
|
||||
const pseudocode = await cold.call("procedure_pseudo_code", {
|
||||
procedure: address,
|
||||
});
|
||||
assert.equal(pseudocode.structured.subject.digest.sha256, sha256);
|
||||
assert.equal(pseudocode.structured.provider.id, "kuna");
|
||||
const source = pseudocode.structured.raw_result?.source?.kind;
|
||||
// A fast export can finish before the first request reaches the
|
||||
// decompile path; both sources are valid answers. The single-function
|
||||
// fallback itself is covered by the provider's boundary tests.
|
||||
assert.ok(
|
||||
source === "single-function" || source === "project-export",
|
||||
`Unexpected pseudocode source ${String(source)}`,
|
||||
);
|
||||
const assembly = await cold.call("procedure_assembly", {
|
||||
procedure: address,
|
||||
});
|
||||
assert.equal(
|
||||
assembly.structured.raw_result.source.kind,
|
||||
"project-export",
|
||||
);
|
||||
assert.match(assembly.value, new RegExp(`: ; ${address}\\n`, "u"));
|
||||
const exported = await cold.call("procedure_pseudo_code", {
|
||||
procedure: address,
|
||||
});
|
||||
const recorded = exported.structured.raw_result.source;
|
||||
assert.equal(recorded.kind, "project-export");
|
||||
const block = (await readFile(join(recorded.directory, recorded.file)))
|
||||
.subarray(
|
||||
recorded.byte_offset,
|
||||
recorded.byte_offset + recorded.byte_length,
|
||||
)
|
||||
.toString("utf8");
|
||||
assert.ok(
|
||||
exported.value === null || block.includes(exported.value),
|
||||
"Served pseudocode differs from the recorded export span",
|
||||
);
|
||||
const dossier = await cold.call("analyze_function", {
|
||||
procedure: address,
|
||||
});
|
||||
assert.deepEqual(
|
||||
dossier.structured.relationship_coverage,
|
||||
references.relationship_coverage,
|
||||
"Function dossier lost the directional call coverage",
|
||||
);
|
||||
const combined = dossier.structured.raw_result.source;
|
||||
assert.equal(combined.kind, "project-export");
|
||||
assert.deepEqual(
|
||||
combined.files.map(({ facet }) => facet),
|
||||
["pseudocode", "assembly"],
|
||||
);
|
||||
for (const file of combined.files) {
|
||||
const bytes = await readFile(join(combined.directory, file.file));
|
||||
assert.equal(
|
||||
createHash("sha256").update(bytes).digest("hex"),
|
||||
file.file_sha256,
|
||||
);
|
||||
const span = bytes
|
||||
.subarray(file.byte_offset, file.byte_offset + file.byte_length)
|
||||
.toString("utf8");
|
||||
const facet = dossier.value[file.facet];
|
||||
assert.ok(
|
||||
span.includes(Array.isArray(facet) ? facet.join("\n") : facet),
|
||||
);
|
||||
}
|
||||
answers.push({
|
||||
name,
|
||||
address,
|
||||
cold_source: source,
|
||||
cold_ms: pseudocode.ms,
|
||||
export_wait_ms: assembly.ms,
|
||||
warm_same_session_ms: exported.ms,
|
||||
response_bytes: exported.bytes,
|
||||
dossier_response_bytes: dossier.bytes,
|
||||
...quality(exported.value),
|
||||
references,
|
||||
});
|
||||
}
|
||||
} catch (cause) {
|
||||
coldFailure = cause;
|
||||
} finally {
|
||||
answers.push({ cold_server: await cold.close(coldFailure) });
|
||||
}
|
||||
const staging = await readdir(join(cacheRoot, "staging"));
|
||||
assert.deepEqual(staging, [], "Kuna staging survived a completed export");
|
||||
// A fresh server reuses the export immediately.
|
||||
const warm = await openServer({ path, id: "kuna" });
|
||||
let warmFailure;
|
||||
try {
|
||||
for (const answer of answers)
|
||||
if (answer.address !== undefined) {
|
||||
const reread = await warm.call("procedure_pseudo_code", {
|
||||
procedure: answer.address,
|
||||
});
|
||||
assert.equal(
|
||||
reread.structured.raw_result.source.kind,
|
||||
"project-export",
|
||||
);
|
||||
answer.warm_fresh_server_ms = reread.ms;
|
||||
}
|
||||
} catch (cause) {
|
||||
warmFailure = cause;
|
||||
} finally {
|
||||
answers.push({ warm_server: await warm.close(warmFailure) });
|
||||
}
|
||||
return answers;
|
||||
};
|
||||
|
||||
/** Measure Ghidra on the same functions through the same public workflow. */
|
||||
const measureGhidra = async (path, functions) => {
|
||||
const server = await openServer({ path, id: "ghidra" });
|
||||
const answers = [];
|
||||
let failure;
|
||||
try {
|
||||
for (const [name, address] of functions) {
|
||||
const cold = await server.call("procedure_pseudo_code", {
|
||||
procedure: address,
|
||||
});
|
||||
const warm = await server.call("procedure_pseudo_code", {
|
||||
procedure: address,
|
||||
});
|
||||
answers.push({
|
||||
name,
|
||||
address,
|
||||
first_call_ms: cold.ms,
|
||||
repeat_ms: warm.ms,
|
||||
response_bytes: cold.bytes,
|
||||
...quality(cold.value),
|
||||
});
|
||||
}
|
||||
} catch (cause) {
|
||||
failure = cause;
|
||||
} finally {
|
||||
answers.push({ server: await server.close(failure) });
|
||||
}
|
||||
return answers;
|
||||
};
|
||||
|
||||
/** Symbol-bearing caller binaries with the requested functions, beside their stripped copies. */
|
||||
const targetPairs = async (root, names) => {
|
||||
const pairs = [];
|
||||
for (const flavor of (await readdir(root)).sort()) {
|
||||
const directory = join(root, flavor);
|
||||
if (!(await stat(directory)).isDirectory()) continue;
|
||||
for (const file of (await readdir(directory)).sort()) {
|
||||
if (file.endsWith(".stripped")) continue;
|
||||
const symbols = await symbolAddresses(join(directory, file), names);
|
||||
if (symbols.size > 0) pairs.push({ flavor, directory, file, symbols });
|
||||
}
|
||||
}
|
||||
return pairs;
|
||||
};
|
||||
|
||||
/** Verify Kuna, and optionally measure Ghidra, on one binary of a pair. */
|
||||
const verifyVariant = async ({ flavor, directory, symbols }, variant) => {
|
||||
const path = join(directory, variant);
|
||||
const entry = { binary: `${flavor}/${variant}` };
|
||||
entry.kuna = await verifyKuna(path, [...symbols]);
|
||||
if (values["compare-ghidra"])
|
||||
entry.ghidra = await measureGhidra(path, [...symbols]);
|
||||
process.stderr.write(`verified ${entry.binary}\n`);
|
||||
return entry;
|
||||
};
|
||||
|
||||
const results = [];
|
||||
const failures = [];
|
||||
try {
|
||||
kunaVersion = (
|
||||
await execFileOutput(kuna, ["--version"], {
|
||||
timeout: 10_000,
|
||||
maxBuffer: 64 * 1024,
|
||||
stopSignal: "SIGTERM",
|
||||
})
|
||||
).stdout.trim();
|
||||
let callerPairs = [];
|
||||
if (values.targets !== undefined) {
|
||||
const names = (values.functions ?? "").split(",").filter(Boolean);
|
||||
assert.ok(names.length > 0, "--targets requires --functions");
|
||||
callerPairs = await targetPairs(values.targets, names);
|
||||
assert.ok(
|
||||
callerPairs.length > 0,
|
||||
`No caller-built targets contain the requested functions in ${values.targets}`,
|
||||
);
|
||||
const found = new Set(
|
||||
callerPairs.flatMap(({ symbols }) => [...symbols.keys()]),
|
||||
);
|
||||
const missing = names.filter((name) => !found.has(name));
|
||||
assert.deepEqual(
|
||||
missing,
|
||||
[],
|
||||
"Requested functions were not found in any caller-built target",
|
||||
);
|
||||
}
|
||||
|
||||
// Source-owned fixture: always built and verified.
|
||||
const fixtureDir = join(workspace, "fixture");
|
||||
await mkdir(fixtureDir);
|
||||
const source = join(fixtureDir, "fixture.c");
|
||||
await writeFile(source, FIXTURE_SOURCE);
|
||||
const built = join(fixtureDir, "rea-kuna-fixture");
|
||||
await exec(process.env.REA_CC ?? "cc", ["-O2", "-o", built, source]);
|
||||
const stripped = `${built}.stripped`;
|
||||
await writeFile(stripped, await readFile(built));
|
||||
await exec(process.env.REA_STRIP ?? "strip", [stripped]);
|
||||
const fixtureFunctions = await symbolAddresses(built, [
|
||||
"rea_checksum",
|
||||
"rea_classify",
|
||||
"main",
|
||||
]);
|
||||
assert.equal(fixtureFunctions.size, 3, "Fixture symbols were not found");
|
||||
const fixtureMain = fixtureFunctions.get("main");
|
||||
fixtureFunctions.delete("main");
|
||||
for (const binary of [built, stripped])
|
||||
results.push({
|
||||
binary: binary.slice(workspace.length + 1),
|
||||
kuna: await verifyKuna(binary, [...fixtureFunctions], fixtureMain, [
|
||||
"_φ( °-°)/ REA unicode marker",
|
||||
"REA wide marker",
|
||||
]),
|
||||
});
|
||||
|
||||
// Caller-built matrix.
|
||||
for (const pair of callerPairs)
|
||||
for (const variant of [pair.file, `${pair.file}.stripped`])
|
||||
results.push(await verifyVariant(pair, variant));
|
||||
} catch (cause) {
|
||||
failures.push(cause);
|
||||
}
|
||||
// Failure paths need the same process evidence as successful verification.
|
||||
for (const retained of [...retainedNative]) {
|
||||
try {
|
||||
const stopped = await retained.owner?.stop();
|
||||
if (stopped !== undefined && stopped.status !== "incomplete")
|
||||
retainedNative.delete(retained);
|
||||
} catch (cause) {
|
||||
failures.push(cause);
|
||||
}
|
||||
}
|
||||
const lifecycle = await completeVerifierRun(run);
|
||||
let cleanupComplete = pendingServers.size === 0 && retainedNative.size === 0;
|
||||
try {
|
||||
assertVerifierCleanupComplete(lifecycle.process_lineage);
|
||||
} catch (cause) {
|
||||
cleanupComplete = false;
|
||||
failures.push(cause);
|
||||
}
|
||||
if (cleanupComplete)
|
||||
try {
|
||||
await rm(workspace, { recursive: true, force: true });
|
||||
} catch (cause) {
|
||||
cleanupComplete = false;
|
||||
failures.push(cause);
|
||||
}
|
||||
const describeFailure = (cause) => ({
|
||||
message: cause instanceof Error ? cause.message : String(cause),
|
||||
...(cause instanceof AggregateError
|
||||
? { causes: cause.errors.map(describeFailure) }
|
||||
: {}),
|
||||
});
|
||||
const report = {
|
||||
lane: "kuna",
|
||||
status: failures.length === 0 ? "passed" : "failed",
|
||||
kuna_version: kunaVersion,
|
||||
platform: `${process.platform}/${process.arch}`,
|
||||
verifier_run: lifecycle,
|
||||
results,
|
||||
limitations: [
|
||||
"Targets are analyzed statically; they are never executed.",
|
||||
"Memory is the sampled peak resident set of the MCP server process tree; CPU is its sampled cumulative time. A short-lived peak between 200 ms samples is not observed.",
|
||||
"Quality signals count gotos and warning markers only; they are not a correctness judgement and not a DecBench reproduction.",
|
||||
"Response bytes are UTF-8 serialization sizes. Model token usage, tool schema costs and agent task completion were not measured.",
|
||||
],
|
||||
cleanup: cleanupComplete ? "complete" : "incomplete",
|
||||
...(cleanupComplete ? {} : { retained_workspace: workspace }),
|
||||
...(failures.length === 0 ? {} : { failures: failures.map(describeFailure) }),
|
||||
};
|
||||
if (values.report !== undefined)
|
||||
await writeFile(values.report, `${JSON.stringify(report, null, 2)}\n`);
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
if (failures.length > 0)
|
||||
throw new AggregateError(
|
||||
failures,
|
||||
"Kuna verification failed; see the report for cleanup evidence",
|
||||
);
|
||||
@@ -1,111 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { createHash } from "node:crypto";
|
||||
import {
|
||||
access,
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
readdir,
|
||||
rename,
|
||||
rm,
|
||||
stat,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { createRequire } from "node:module";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
|
||||
if (process.platform !== "win32")
|
||||
throw new Error("Requires actual Windows NTFS");
|
||||
const [rootArgument, artifactArgument, expected] = process.argv.slice(2);
|
||||
assert.ok(rootArgument && artifactArgument);
|
||||
assert.ok(expected === "expect-leak" || expected === "retain-owner");
|
||||
const root = resolve(rootArgument);
|
||||
const artifact = resolve(artifactArgument);
|
||||
const manifest = JSON.parse(
|
||||
await readFile(join(artifact, "manifest.json"), "utf8"),
|
||||
);
|
||||
const image = await readFile(join(artifact, manifest.artifact));
|
||||
assert.equal(
|
||||
createHash("sha256").update(image).digest("hex"),
|
||||
manifest.artifactSha256,
|
||||
);
|
||||
assert.equal(manifest.abiVersion, 1);
|
||||
assert.equal(manifest.nodeApiVersion, 8);
|
||||
const native = createRequire(join(root, "package.json"))(
|
||||
join(artifact, manifest.artifact),
|
||||
);
|
||||
const workspace = await mkdtemp(join(tmpdir(), "rea-failed-creation-probe-"));
|
||||
process.env.REA_NATIVE_CREATION_FAILURE = "1";
|
||||
let retry;
|
||||
const failures = [];
|
||||
try {
|
||||
let failure;
|
||||
try {
|
||||
native.call("runtime_create", [workspace, "owned-"]);
|
||||
} catch (cause) {
|
||||
failure = cause;
|
||||
}
|
||||
assert.equal(failure?.constraint, "Read private DACL by handle failed");
|
||||
assert.equal(failure?.win32Code, 5);
|
||||
assert.notEqual(failure.runtimeAllocation, "not-started");
|
||||
if (expected === "retain-owner") {
|
||||
assert.equal(
|
||||
failure.cleanupConstraint,
|
||||
"Delete owned object by handle failed",
|
||||
);
|
||||
assert.equal(failure.cleanupWin32Code, 5);
|
||||
} else assert.equal(failure.cleanupConstraint, undefined);
|
||||
const [name, ...extra] = await readdir(workspace);
|
||||
assert.ok(name && name.startsWith("owned-"));
|
||||
assert.equal(extra.length, 0);
|
||||
const allocated = join(workspace, name);
|
||||
const identity = await stat(allocated, { bigint: true });
|
||||
assert.equal(failure.requestedPath, allocated);
|
||||
const moved = allocated + "-moved";
|
||||
await writeFile(join(allocated, "owned-child.txt"), "owned child");
|
||||
await rename(allocated, moved);
|
||||
await mkdir(allocated);
|
||||
const replacement = await stat(allocated, { bigint: true });
|
||||
assert.notEqual(replacement.ino, identity.ino);
|
||||
const sentinel = join(allocated, "unrelated.txt");
|
||||
await writeFile(sentinel, "preserve replacement");
|
||||
|
||||
retry = native.call("runtime_create", [workspace, "retry-"]);
|
||||
native.call("runtime_close", [retry.handle]);
|
||||
retry = undefined;
|
||||
if (expected === "expect-leak") {
|
||||
assert.equal((await stat(moved, { bigint: true })).ino, identity.ino);
|
||||
assert.equal(
|
||||
await readFile(join(moved, "owned-child.txt"), "utf8"),
|
||||
"owned child",
|
||||
);
|
||||
} else await assert.rejects(access(moved), { code: "ENOENT" });
|
||||
assert.equal((await stat(allocated, { bigint: true })).ino, replacement.ino);
|
||||
assert.equal(await readFile(sentinel, "utf8"), "preserve replacement");
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
ok: true,
|
||||
expected,
|
||||
postAllocationValidationDenied: true,
|
||||
rollbackDispositionDenied: true,
|
||||
baselineLostOwner: expected === "expect-leak",
|
||||
renamedOwnerRemovedOnRetry: expected === "retain-owner",
|
||||
unrelatedReplacementPreserved: true,
|
||||
fixtureArtifactSha256: manifest.artifactSha256,
|
||||
originalHostDeleteDenialReproduced: false,
|
||||
}),
|
||||
);
|
||||
} catch (failure) {
|
||||
failures.push(failure);
|
||||
console.error(failure);
|
||||
}
|
||||
try {
|
||||
if (retry) native.call("runtime_close", [retry.handle]);
|
||||
native.call("inspect", []);
|
||||
await rm(workspace, { recursive: true, force: true });
|
||||
} catch (cleanupFailure) {
|
||||
failures.push(cleanupFailure);
|
||||
}
|
||||
if (failures.length !== 0)
|
||||
throw new AggregateError(failures, "Creation ownership probe failed");
|
||||
@@ -1,175 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import {
|
||||
access,
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
rename,
|
||||
rm,
|
||||
stat,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
if (process.platform !== "win32")
|
||||
throw new Error("Requires actual Windows NTFS");
|
||||
const [rootArgument, expected] = process.argv.slice(2);
|
||||
assert.ok(rootArgument);
|
||||
assert.ok(expected === "deny-clear" || expected === "allow");
|
||||
const root = resolve(rootArgument);
|
||||
const { requireWindowsNativeAuthority } = await import(
|
||||
pathToFileURL(join(root, "dist/windows/WindowsNativeLoader.js"))
|
||||
);
|
||||
const native = requireWindowsNativeAuthority();
|
||||
const workspace = await mkdtemp(join(tmpdir(), "rea-readonly-root-probe-"));
|
||||
const roots = [];
|
||||
const attributes = (path, readonly) => {
|
||||
const script = `$ErrorActionPreference='Stop';
|
||||
$path=$env:REA_OWNED_ATTRIBUTE_PROBE;
|
||||
$current=[int][IO.File]::GetAttributes($path);
|
||||
$next=if($env:REA_ATTRIBUTE_PROBE_MODE -eq 'only'){1}elseif($env:REA_ATTRIBUTE_PROBE_MODE -eq 'set'){ $current -bor 1 }else{ $current -band (-bnot 1) };
|
||||
[IO.File]::SetAttributes($path,[IO.FileAttributes]$next);
|
||||
$observed=[int][IO.File]::GetAttributes($path);
|
||||
@{readonly=(($observed -band 1) -ne 0); attributes=$observed} | ConvertTo-Json -Compress`;
|
||||
const result = JSON.parse(
|
||||
execFileSync(
|
||||
"powershell.exe",
|
||||
["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script],
|
||||
{
|
||||
encoding: "utf8",
|
||||
timeout: 10000,
|
||||
windowsHide: true,
|
||||
env: {
|
||||
...process.env,
|
||||
REA_OWNED_ATTRIBUTE_PROBE: path,
|
||||
REA_ATTRIBUTE_PROBE_MODE: readonly === "only" ? "only" : readonly ? "set" : "clear",
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
assert.equal(result.readonly, Boolean(readonly));
|
||||
return result;
|
||||
};
|
||||
const create = () => {
|
||||
const runtime = native.call("runtime_create", [workspace, "owned-"]);
|
||||
const owned = { runtime, currentPath: runtime.path, closed: false };
|
||||
roots.push(owned);
|
||||
return owned;
|
||||
};
|
||||
const close = (owned) => {
|
||||
native.call("runtime_close", [owned.runtime.handle]);
|
||||
owned.closed = true;
|
||||
};
|
||||
try {
|
||||
const normal = create();
|
||||
close(normal);
|
||||
await assert.rejects(access(normal.currentPath), { code: "ENOENT" });
|
||||
|
||||
const owned = create();
|
||||
const original = owned.currentPath;
|
||||
const originalIdentity = await stat(original, { bigint: true });
|
||||
const marked = attributes(original, true);
|
||||
assert.notEqual(marked.attributes & 16, 0, "Probe must be a directory");
|
||||
const moved = original + "-moved";
|
||||
await rename(original, moved);
|
||||
owned.currentPath = moved;
|
||||
await mkdir(original);
|
||||
const replacementIdentity = await stat(original, { bigint: true });
|
||||
assert.notEqual(replacementIdentity.ino, originalIdentity.ino);
|
||||
const sentinel = join(original, "unrelated.txt");
|
||||
await writeFile(sentinel, "replacement must survive");
|
||||
let failure;
|
||||
try {
|
||||
close(owned);
|
||||
} catch (cause) {
|
||||
failure = cause;
|
||||
}
|
||||
if (expected === "deny-clear") {
|
||||
assert.equal(failure?.win32Code, 5);
|
||||
assert.equal(failure?.constraint, "Clear owned readonly attribute failed");
|
||||
assert.equal(
|
||||
(await stat(moved, { bigint: true })).ino,
|
||||
originalIdentity.ino,
|
||||
);
|
||||
attributes(moved, false);
|
||||
close(owned);
|
||||
} else assert.equal(failure, undefined, failure?.message);
|
||||
await assert.rejects(access(moved), { code: "ENOENT" });
|
||||
assert.equal(
|
||||
(await stat(original, { bigint: true })).ino,
|
||||
replacementIdentity.ino,
|
||||
);
|
||||
assert.equal(await readFile(sentinel, "utf8"), "replacement must survive");
|
||||
|
||||
const stationary = create();
|
||||
attributes(stationary.currentPath, true);
|
||||
if (expected === "deny-clear") {
|
||||
assert.throws(
|
||||
() => close(stationary),
|
||||
(error) =>
|
||||
error.win32Code === 5 &&
|
||||
error.constraint === "Clear owned readonly attribute failed",
|
||||
);
|
||||
attributes(stationary.currentPath, false);
|
||||
}
|
||||
close(stationary);
|
||||
await assert.rejects(access(stationary.currentPath), { code: "ENOENT" });
|
||||
|
||||
const children = create();
|
||||
native.call("runtime_mkdir", [children.runtime.handle, "nested"]);
|
||||
native.call("runtime_write", [
|
||||
children.runtime.handle,
|
||||
"nested/readonly.txt",
|
||||
Buffer.from("owned readonly file"),
|
||||
]);
|
||||
attributes(children.currentPath, true);
|
||||
attributes(join(children.currentPath, "nested"), true);
|
||||
attributes(join(children.currentPath, "nested", "readonly.txt"), true);
|
||||
if (expected === "deny-clear") {
|
||||
assert.throws(
|
||||
() => close(children),
|
||||
(error) =>
|
||||
error.win32Code === 5 &&
|
||||
error.constraint === "Clear owned readonly attribute failed",
|
||||
);
|
||||
attributes(children.currentPath, false);
|
||||
}
|
||||
close(children);
|
||||
await assert.rejects(access(children.currentPath), { code: "ENOENT" });
|
||||
const onlyReadonly = create();
|
||||
native.call("runtime_write", [onlyReadonly.runtime.handle, "only-readonly.txt", Buffer.from("owned file")]);
|
||||
const onlyReadonlyPath = join(onlyReadonly.currentPath, "only-readonly.txt");
|
||||
assert.equal(attributes(onlyReadonlyPath, "only").attributes, 1);
|
||||
if (expected === "deny-clear") {
|
||||
assert.throws(() => close(onlyReadonly), error => error.win32Code === 5 && error.constraint === "Delete owned object by handle failed");
|
||||
attributes(onlyReadonlyPath, false);
|
||||
}
|
||||
close(onlyReadonly);
|
||||
await assert.rejects(access(onlyReadonly.currentPath), { code: "ENOENT" });
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
ok: true,
|
||||
expected,
|
||||
rootReadonlyConfirmed: true,
|
||||
stationaryRootRemoved: true,
|
||||
populatedReadonlyRootRemoved: true,
|
||||
renamedOwnedRootRemoved: true,
|
||||
unrelatedReplacementPreserved: true,
|
||||
readonlyChildFileAndDirectoryRemoved: true,
|
||||
readonlyFileWithoutOtherAttributesRemoved: true,
|
||||
baselineConstraint: failure?.constraint ?? null,
|
||||
baselineWin32: failure?.win32Code ?? null,
|
||||
originalIssueDeleteDenialReproduced: false,
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
for (const owned of roots) {
|
||||
if (owned.closed) continue;
|
||||
attributes(owned.currentPath, false);
|
||||
close(owned);
|
||||
}
|
||||
await rm(workspace, { recursive: true, force: true });
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { performance } from "node:perf_hooks";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { parseArgs } from "node:util";
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { artifactCliEvidence } from "../../lib/artifact-e2e.mjs";
|
||||
import { closeVerifierResources } from "../../lib/verifier-cleanup.mjs";
|
||||
import { PrivateRuntimeRoot } from "../../../dist/process/PrivateRuntimeRoot.js";
|
||||
import {
|
||||
OwnedCommandFailure,
|
||||
runOwnedCommand,
|
||||
} from "../../../dist/process/OwnedCommand.js";
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
artifact: { type: "string" },
|
||||
"source-path": { type: "string", multiple: true },
|
||||
path: { type: "string" },
|
||||
kind: { type: "string" },
|
||||
rounds: { type: "string", default: "3" },
|
||||
mode: { type: "string", default: "parity" },
|
||||
"cli-parity": { type: "boolean", default: false },
|
||||
"tokenizer-python": { type: "string" },
|
||||
"tokenizer-timeout-ms": { type: "string", default: "60000" },
|
||||
},
|
||||
strict: true,
|
||||
});
|
||||
assert.ok(values.artifact?.startsWith("/"), "--artifact must be absolute");
|
||||
assert.ok(["parity", "legacy", "references"].includes(values.mode));
|
||||
const rounds = Number(values.rounds);
|
||||
assert.ok(Number.isSafeInteger(rounds) && rounds > 0);
|
||||
const tokenizerTimeoutMs = Number(values["tokenizer-timeout-ms"]);
|
||||
assert.ok(
|
||||
Number.isSafeInteger(tokenizerTimeoutMs) && tokenizerTimeoutMs > 0,
|
||||
"--tokenizer-timeout-ms must be a positive safe integer",
|
||||
);
|
||||
const where = {
|
||||
...(values.path === undefined ? {} : { path: values.path }),
|
||||
...(values.kind === undefined ? {} : { kind: values.kind }),
|
||||
};
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
args: [fileURLToPath(new URL("../../rea.mjs", import.meta.url)), "mcp"],
|
||||
env: {
|
||||
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
||||
REA_LOG_LEVEL: "silent",
|
||||
REA_ANALYSIS_PROVIDER: "auto",
|
||||
},
|
||||
stderr: "pipe",
|
||||
});
|
||||
const client = new Client({
|
||||
name: "javascript-module-reference-verifier",
|
||||
version: "1",
|
||||
});
|
||||
const serialize = (value) => JSON.stringify(value);
|
||||
const bytes = (value) => Buffer.byteLength(serialize(value));
|
||||
const digest = (value) =>
|
||||
createHash("sha256").update(serialize(value)).digest("hex");
|
||||
const support = (observations) => [
|
||||
...new Map(
|
||||
observations.map(({ evidence }) => {
|
||||
const basis = {
|
||||
authority: evidence.authority,
|
||||
state: evidence.state,
|
||||
confidence: evidence.confidence,
|
||||
};
|
||||
return [serialize(basis), basis];
|
||||
}),
|
||||
).values(),
|
||||
];
|
||||
const normalize = (rows) =>
|
||||
rows.map((row) => ({
|
||||
...row,
|
||||
basis: [...row.basis].sort((a, b) =>
|
||||
serialize(a).localeCompare(serialize(b)),
|
||||
),
|
||||
}));
|
||||
let temporary;
|
||||
let primaryError;
|
||||
let retainTemporary = false;
|
||||
try {
|
||||
await client.connect(transport);
|
||||
transport.stderr?.resume();
|
||||
const tools = (await client.listTools()).tools;
|
||||
const relevant = tools.filter(({ name }) =>
|
||||
["analyze_javascript_application", "inspect_analysis_view"].includes(name),
|
||||
);
|
||||
assert.equal(relevant.length, 2);
|
||||
const call = async (name, args, transcript) => {
|
||||
const response = await client.callTool(
|
||||
{ name, arguments: args },
|
||||
{ timeout: 360_000 },
|
||||
);
|
||||
if (response.isError) throw new Error(serialize(response));
|
||||
const evidence = response.structuredContent;
|
||||
assert.ok(evidence?.evidence_id && evidence.normalized_result);
|
||||
transcript?.push({
|
||||
request: { name, arguments: args },
|
||||
response: evidence,
|
||||
});
|
||||
return evidence;
|
||||
};
|
||||
const preparationStart = performance.now();
|
||||
const preparationRequest = {
|
||||
input_path: values.artifact,
|
||||
detail: "summary",
|
||||
...(values["source-path"] === undefined
|
||||
? {}
|
||||
: { source_paths: values["source-path"] }),
|
||||
};
|
||||
const summary = await call(
|
||||
"analyze_javascript_application",
|
||||
preparationRequest,
|
||||
);
|
||||
const source = {
|
||||
kind: "retained-evidence",
|
||||
evidence_id: summary.normalized_result.parent_evidence_id,
|
||||
};
|
||||
const preparationMs = performance.now() - preparationStart;
|
||||
const samples = [];
|
||||
const costInputs = {};
|
||||
let canonical;
|
||||
for (let round = 0; round < rounds; round += 1) {
|
||||
const modes =
|
||||
values.mode === "parity"
|
||||
? round % 2 === 0
|
||||
? ["legacy", "references"]
|
||||
: ["references", "legacy"]
|
||||
: [values.mode];
|
||||
for (const mode of modes) {
|
||||
const transcript = [];
|
||||
const started = performance.now();
|
||||
let rows;
|
||||
let coverage;
|
||||
if (mode === "legacy") {
|
||||
const page = await call(
|
||||
"inspect_analysis_view",
|
||||
{
|
||||
source,
|
||||
view: {
|
||||
kind: "page",
|
||||
collection: "modules",
|
||||
offset: 0,
|
||||
limit: Number.MAX_SAFE_INTEGER,
|
||||
},
|
||||
},
|
||||
transcript,
|
||||
);
|
||||
assert.equal(page.normalized_result.coverage.exhausted, true);
|
||||
rows = [];
|
||||
for (const row of page.normalized_result.items) {
|
||||
if (where.path !== undefined && row.path !== where.path) continue;
|
||||
if (where.kind !== undefined && row.kind !== where.kind) continue;
|
||||
const itemEvidence = await call(
|
||||
"inspect_analysis_view",
|
||||
{
|
||||
source,
|
||||
view: {
|
||||
kind: "item",
|
||||
collection: "modules",
|
||||
selector: { node_id: row.node_id },
|
||||
},
|
||||
},
|
||||
transcript,
|
||||
);
|
||||
const item = itemEvidence.normalized_result.item;
|
||||
rows.push({
|
||||
node_id: item.node_id,
|
||||
kind: item.kind,
|
||||
path: item.path,
|
||||
identity: item.identity,
|
||||
retained_source_range_count: item.source_ranges.length,
|
||||
basis: support(item.observations),
|
||||
});
|
||||
}
|
||||
coverage = page.normalized_result.coverage;
|
||||
} else {
|
||||
const references = await call(
|
||||
"inspect_analysis_view",
|
||||
{
|
||||
source,
|
||||
view: {
|
||||
kind: "javascript",
|
||||
collection: "modules",
|
||||
projection: "references",
|
||||
where,
|
||||
offset: 0,
|
||||
limit: Number.MAX_SAFE_INTEGER,
|
||||
},
|
||||
},
|
||||
transcript,
|
||||
);
|
||||
const result = references.normalized_result;
|
||||
rows = result.rows;
|
||||
coverage = result.coverage;
|
||||
assert.equal(coverage.exhausted, true);
|
||||
assert.deepEqual(
|
||||
result.source_coverage.application,
|
||||
summary.normalized_result.summary.coverage.application,
|
||||
);
|
||||
assert.deepEqual(
|
||||
result.source_coverage.source_selection,
|
||||
summary.normalized_result.summary.source_selection,
|
||||
);
|
||||
assert.equal(
|
||||
result.source_coverage.semantic.status,
|
||||
summary.normalized_result.summary.coverage.semantic.status,
|
||||
);
|
||||
assert.equal(
|
||||
result.source_coverage.application_unknown_count,
|
||||
summary.normalized_result.summary.coverage.application_unknowns,
|
||||
);
|
||||
assert.equal(
|
||||
result.source_coverage.semantic_unknown_count,
|
||||
summary.normalized_result.summary.coverage.semantic_unknowns,
|
||||
);
|
||||
}
|
||||
assert.ok(
|
||||
rows.length > 0,
|
||||
"No matching modules; select a representative nonempty task",
|
||||
);
|
||||
const normalized = normalize(rows);
|
||||
canonical ??= normalized;
|
||||
assert.deepEqual(
|
||||
normalized,
|
||||
canonical,
|
||||
"Module facts changed across workflows/rounds",
|
||||
);
|
||||
samples.push({
|
||||
round,
|
||||
mode,
|
||||
elapsed_ms: performance.now() - started,
|
||||
calls: transcript.length,
|
||||
structured_reply_bytes: transcript.reduce(
|
||||
(total, entry) => total + bytes(entry.response),
|
||||
0,
|
||||
),
|
||||
facts_sha256: digest(normalized),
|
||||
matching_modules: rows.length,
|
||||
coverage,
|
||||
});
|
||||
costInputs[mode] ??= {
|
||||
catalog: relevant.map(({ name, description, inputSchema }) => ({
|
||||
name,
|
||||
description,
|
||||
inputSchema,
|
||||
})),
|
||||
full_catalog: tools.map(({ name, description, inputSchema }) => ({
|
||||
name,
|
||||
description,
|
||||
inputSchema,
|
||||
})),
|
||||
common_summary: summary,
|
||||
common_request: {
|
||||
name: "analyze_javascript_application",
|
||||
arguments: preparationRequest,
|
||||
},
|
||||
transcript,
|
||||
};
|
||||
}
|
||||
}
|
||||
let cliParity = null;
|
||||
if (values["cli-parity"]) {
|
||||
temporary = await PrivateRuntimeRoot.create({
|
||||
prefix: "rea-module-reference-verifier-",
|
||||
});
|
||||
const bundlePath = join(temporary.path, "bundle.json");
|
||||
const exported = await client.callTool({
|
||||
name: "export_evidence_bundle",
|
||||
arguments: { path: bundlePath },
|
||||
});
|
||||
if (exported.isError) throw new Error(serialize(exported));
|
||||
const bundle = JSON.parse(await readFile(bundlePath, "utf8"));
|
||||
const parent = bundle.records.find(
|
||||
({ evidence_id }) => evidence_id === source.evidence_id,
|
||||
);
|
||||
assert.ok(parent, "Export omitted the retained analysis parent");
|
||||
const request = join(temporary.path, "view.json");
|
||||
await writeFile(
|
||||
request,
|
||||
serialize({
|
||||
source: { kind: "inline", evidence: parent },
|
||||
view: {
|
||||
kind: "javascript",
|
||||
collection: "modules",
|
||||
projection: "references",
|
||||
where,
|
||||
offset: 0,
|
||||
limit: Number.MAX_SAFE_INTEGER,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const cli = await artifactCliEvidence("inspect-analysis-view", request);
|
||||
assert.deepEqual(normalize(cli.normalized_result.rows), canonical);
|
||||
assert.equal(cli.normalized_result.parent_evidence_id, parent.evidence_id);
|
||||
const retained = await call("inspect_analysis_view", {
|
||||
source,
|
||||
view: cli.normalized_result.view,
|
||||
});
|
||||
assert.deepEqual(cli.normalized_result, retained.normalized_result);
|
||||
assert.equal(cli.evidence_id, retained.evidence_id);
|
||||
cliParity = {
|
||||
evidence_id: cli.evidence_id,
|
||||
facts_sha256: digest(canonical),
|
||||
exact_cli_mcp_view_parity: true,
|
||||
};
|
||||
}
|
||||
let tokenCosts = null;
|
||||
if (values["tokenizer-python"]) {
|
||||
temporary ??= await PrivateRuntimeRoot.create({
|
||||
prefix: "rea-module-reference-verifier-",
|
||||
});
|
||||
const input = join(temporary.path, "token-input.json");
|
||||
await writeFile(input, serialize(costInputs));
|
||||
let result;
|
||||
try {
|
||||
result = await runOwnedCommand(
|
||||
{
|
||||
command: values["tokenizer-python"],
|
||||
arguments: [
|
||||
"-c",
|
||||
`
|
||||
import json, sys, tiktoken
|
||||
with open(sys.argv[1], encoding='utf-8') as source:
|
||||
data=json.load(source)
|
||||
enc=tiktoken.get_encoding('cl100k_base')
|
||||
def count(value):
|
||||
return len(enc.encode(json.dumps(value,ensure_ascii=False,separators=(',',':')),disallowed_special=()))
|
||||
out={}
|
||||
for mode, task in data.items():
|
||||
replies=sum(count(entry['response']) for entry in task['transcript'])
|
||||
requests=sum(count(entry['request']) for entry in task['transcript'])
|
||||
common=count(task['common_summary'])
|
||||
common_request=count(task['common_request'])
|
||||
selected=count(task['catalog'])
|
||||
full=count(task['full_catalog'])
|
||||
out[mode]=dict(selected_catalog=selected,full_catalog=full,common_request=common_request,common_summary=common,requests=requests,structured_replies=replies,selected_catalog_task_total=selected+common_request+common+requests+replies,full_catalog_task_total=full+common_request+common+requests+replies)
|
||||
print(json.dumps(dict(tokenizer='cl100k_base',tiktoken_version=tiktoken.__version__,costs=out)))
|
||||
`,
|
||||
input,
|
||||
],
|
||||
cwd: temporary.path,
|
||||
runId: `rea-module-token-${randomUUID()}`,
|
||||
// An interpreter wrapper may exec another command. The shared owner
|
||||
// still verifies native identities and the exact inherited run token.
|
||||
expectedCommand: null,
|
||||
sweepTokenOwnedProcesses: true,
|
||||
},
|
||||
{ timeoutMs: tokenizerTimeoutMs, diagnosticBytes: 1024 * 1024 },
|
||||
);
|
||||
} catch (cause) {
|
||||
// An incomplete cleanup carries its supervisor and identity resources in
|
||||
// the error. Preserve its private files for that owner instead of erasing
|
||||
// recovery data while a command may still be using it.
|
||||
retainTemporary =
|
||||
cause instanceof OwnedCommandFailure &&
|
||||
cause.cleanupOwner !== undefined;
|
||||
throw new Error(
|
||||
"Token accounting failed; inspect the owned-command outcome and cleanup status.",
|
||||
{ cause },
|
||||
);
|
||||
}
|
||||
assert.notEqual(
|
||||
result.stdout.invalidUtf8,
|
||||
true,
|
||||
"Tokenizer output must be UTF-8 JSON",
|
||||
);
|
||||
tokenCosts = JSON.parse(result.stdout.text);
|
||||
}
|
||||
process.stdout.write(
|
||||
`${serialize({
|
||||
scope:
|
||||
"Completed module-fact reads from identical retained Evidence; no hosted-model performance claim",
|
||||
artifact: {
|
||||
path: values.artifact,
|
||||
sha256: summary.normalized_result.artifact.sha256,
|
||||
},
|
||||
parent_evidence_id: source.evidence_id,
|
||||
source_selection: summary.normalized_result.summary.source_selection,
|
||||
source_coverage: summary.normalized_result.summary.coverage,
|
||||
where,
|
||||
preparation_ms: preparationMs,
|
||||
samples,
|
||||
token_costs: tokenCosts,
|
||||
cli_parity: cliParity,
|
||||
conditions:
|
||||
"First query is after shared artifact analysis; subsequent queries share one MCP session. Legacy item reads are serial; a concurrent legacy baseline is unmeasured. Filesystem/build warmness uncontrolled. Token costs count one post-change catalog, preparation request/summary and each request/structured reply once; client rendering, replay, reasoning, final answer and model latency are unmeasured. Preparation and parity/tokenization overhead are outside per-query elapsed times; external family-resource receipts include the complete verifier and children.",
|
||||
})}\n`,
|
||||
);
|
||||
} catch (cause) {
|
||||
primaryError = cause;
|
||||
throw cause;
|
||||
} finally {
|
||||
await closeVerifierResources(
|
||||
[
|
||||
() => client.close(),
|
||||
() => transport.close(),
|
||||
async () => {
|
||||
if (temporary === undefined) return;
|
||||
if (retainTemporary)
|
||||
throw new Error(
|
||||
`Command cleanup is incomplete; retaining its private input/Evidence files at ${temporary.path}.`,
|
||||
);
|
||||
await temporary.close();
|
||||
},
|
||||
],
|
||||
primaryError,
|
||||
);
|
||||
}
|
||||
@@ -709,7 +709,7 @@ it("projects package details from dumpsys package output", async () => {
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
version_name: "1.2.3",
|
||||
version_code: 45,
|
||||
version_code: "45",
|
||||
first_install_time: "2026-01-02 03:04:05",
|
||||
last_update_time: "2026-02-03 04:05:06",
|
||||
installer_package_name: "com.android.vending",
|
||||
@@ -719,6 +719,30 @@ it("projects package details from dumpsys package output", async () => {
|
||||
});
|
||||
});
|
||||
|
||||
// PackageInfo.getLongVersionCode() combines versionCodeMajor and versionCode
|
||||
// into a signed 64-bit long, which JSON numbers cannot hold exactly.
|
||||
it.each(["9007199254740993", "-4294967296"])(
|
||||
"keeps the long version code %s exactly as dumpsys prints it",
|
||||
async (versionCode) => {
|
||||
const { binary } = await writeAdbStub(
|
||||
shellStub({
|
||||
"dumpsys:package": `Packages:
|
||||
Package [com.example] (abcdef):
|
||||
versionCode=${versionCode} minSdk=24 targetSdk=34
|
||||
`,
|
||||
}),
|
||||
);
|
||||
const result = await evidenceResult(providerOver(binary), {
|
||||
operation: "inspect_adb_package",
|
||||
input: { serial: "emulator-5554", package: "com.example" },
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
version_code: versionCode,
|
||||
coverage: "complete",
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
// Android 10 and 11 append ": restricted=true" to hard- and soft-restricted
|
||||
// entries of the requested-permissions list (Settings.dumpPackageLPr).
|
||||
it("counts requested permissions that the device marks as restricted", async () => {
|
||||
|
||||
@@ -193,7 +193,8 @@ export const parseWindowFocusOutput = (
|
||||
|
||||
export interface AdbPackageDetails {
|
||||
readonly versionName: string | null;
|
||||
readonly versionCode: number | null;
|
||||
/** Signed 64-bit long version code exactly as Package Manager prints it. */
|
||||
readonly versionCode: string | null;
|
||||
readonly firstInstallTime: string | null;
|
||||
readonly lastUpdateTime: string | null;
|
||||
readonly installerPackageName: string | null;
|
||||
@@ -214,7 +215,7 @@ export const parseDumpsysPackageOutput = (
|
||||
): AdbPackageDetails => {
|
||||
const details: {
|
||||
versionName: string | null;
|
||||
versionCode: number | null;
|
||||
versionCode: string | null;
|
||||
firstInstallTime: string | null;
|
||||
lastUpdateTime: string | null;
|
||||
installerPackageName: string | null;
|
||||
@@ -252,8 +253,8 @@ export const parseDumpsysPackageOutput = (
|
||||
if (key === "versionName" && details.versionName === null)
|
||||
details.versionName = value === "" ? null : value;
|
||||
else if (key === "versionCode" && details.versionCode === null) {
|
||||
const parsed = /^(\d+)/u.exec(value);
|
||||
if (parsed !== null) details.versionCode = Number(parsed[1]!);
|
||||
const parsed = /^(-?\d+)/u.exec(value);
|
||||
if (parsed !== null) details.versionCode = parsed[1]!;
|
||||
} else if (key === "firstInstallTime" && details.firstInstallTime === null)
|
||||
details.firstInstallTime = value === "" ? null : value;
|
||||
else if (key === "lastUpdateTime" && details.lastUpdateTime === null)
|
||||
|
||||
@@ -8,10 +8,12 @@ import { snapshotEnvironment } from "../process/snapshotEnvironment.js";
|
||||
import { ABORTED, waitForAbortable } from "../process/AbortablePromise.js";
|
||||
import { ProviderStartupDeadline } from "../process/ProviderDeadline.js";
|
||||
|
||||
import { randomUUID } from "node:crypto";
|
||||
import {
|
||||
execFileOutput,
|
||||
execFileOutputFailure,
|
||||
} from "../process/ExecFileOutput.js";
|
||||
OwnedCommandFailure,
|
||||
runOwnedCommand,
|
||||
} from "../process/OwnedCommand.js";
|
||||
import type { ProviderProcessSupervisor } from "../process/ProviderProcess.js";
|
||||
import type { ProviderAvailability } from "../application/AnalysisProvider.js";
|
||||
import type { ProviderRejectionCode } from "../contracts/providerSelection.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
@@ -152,14 +154,23 @@ export type ApktoolConfigurationFailureCode =
|
||||
| "version_unresolved"
|
||||
| "unsupported_version";
|
||||
|
||||
/** Unresolved cleanup of a launched probe; its owner was retained separately. */
|
||||
export interface ApktoolProbeCleanup {
|
||||
readonly reason: string;
|
||||
readonly resources: readonly string[];
|
||||
}
|
||||
|
||||
export class ApktoolConfigurationFailure extends Error {
|
||||
readonly cleanup: ApktoolProbeCleanup | undefined;
|
||||
|
||||
constructor(
|
||||
readonly code: ApktoolConfigurationFailureCode,
|
||||
message: string,
|
||||
readonly diagnostics: Readonly<Record<string, JsonValue>> = {},
|
||||
options?: ErrorOptions,
|
||||
options?: ErrorOptions & { readonly cleanup?: ApktoolProbeCleanup },
|
||||
) {
|
||||
super(message, options);
|
||||
this.cleanup = options?.cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,6 +239,7 @@ export const inspectApktoolClient = async (
|
||||
signal?: AbortSignal,
|
||||
environment: Readonly<Record<string, string | undefined>> = process.env,
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
onCleanupOwner?: (owner: ProviderProcessSupervisor) => void,
|
||||
): Promise<ApktoolClientIdentity> => {
|
||||
const hostEnvironment = snapshotEnvironment(environment, platform);
|
||||
let invocation: ApktoolInvocation;
|
||||
@@ -254,23 +266,57 @@ export const inspectApktoolClient = async (
|
||||
let stdout: string;
|
||||
let stderr: string;
|
||||
try {
|
||||
({ stdout, stderr } = await execFileOutput(
|
||||
invocation.command,
|
||||
invocation.arguments,
|
||||
// The owned process group stops a shell launcher's children with it; a
|
||||
// child holding inherited output pipes cannot outlive the deadline.
|
||||
const output = await runOwnedCommand(
|
||||
{
|
||||
command: invocation.command,
|
||||
arguments: invocation.arguments,
|
||||
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
||||
timeout: VERSION_TIMEOUT_MS,
|
||||
stopSignal: "SIGTERM",
|
||||
maxBuffer: VERSION_MAX_OUTPUT_BYTES,
|
||||
env: hostEnvironment,
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
// Apktool launchers are commonly interpreter scripts, so ownership is
|
||||
// proved by the run token rather than the launcher's argv prefix.
|
||||
expectedCommand: null,
|
||||
runId: randomUUID(),
|
||||
hostEnvironment,
|
||||
},
|
||||
));
|
||||
{
|
||||
timeoutMs: VERSION_TIMEOUT_MS,
|
||||
diagnosticBytes: VERSION_MAX_OUTPUT_BYTES,
|
||||
},
|
||||
signal === undefined ? {} : { signal },
|
||||
);
|
||||
stdout = output.stdout.text;
|
||||
stderr = output.stderr.text;
|
||||
} catch (cause) {
|
||||
const failure = execFileOutputFailure(cause);
|
||||
if (signal?.aborted || failure?.code === "ABORT_ERR")
|
||||
throw new AnalysisCancelledError("inspect_apktool_client", { cause });
|
||||
if (failure?.code === "ENOENT")
|
||||
if (
|
||||
cause instanceof OwnedCommandFailure &&
|
||||
cause.cleanupOwner !== undefined
|
||||
)
|
||||
onCleanupOwner?.(cause.cleanupOwner);
|
||||
const cleanup =
|
||||
cause instanceof OwnedCommandFailure && cause.cleanupFailure !== null
|
||||
? { reason: cause.cleanupFailure, resources: cause.resources }
|
||||
: undefined;
|
||||
const cleanupDetails = cleanup === undefined ? {} : { cleanup };
|
||||
if (
|
||||
signal?.aborted === true ||
|
||||
(cause instanceof OwnedCommandFailure && cause.reason === "cancelled")
|
||||
)
|
||||
throw new AnalysisCancelledError("inspect_apktool_client", {
|
||||
cause,
|
||||
...cleanupDetails,
|
||||
});
|
||||
if (cause instanceof OwnedCommandFailure && cause.reason === "timeout")
|
||||
throw new AnalysisTimeoutError(
|
||||
"inspect_apktool_client",
|
||||
VERSION_TIMEOUT_MS,
|
||||
{ cause, ...cleanupDetails },
|
||||
);
|
||||
if (
|
||||
cause instanceof Error &&
|
||||
"code" in cause &&
|
||||
(cause.code === "ENOENT" || cause.code === "EACCES")
|
||||
)
|
||||
throw new ApktoolConfigurationFailure(
|
||||
"command_missing",
|
||||
`The selected apktool launcher was not found: ${selection.command}`,
|
||||
@@ -281,19 +327,25 @@ export const inspectApktoolClient = async (
|
||||
},
|
||||
{ cause },
|
||||
);
|
||||
const snapshot =
|
||||
cause instanceof OwnedCommandFailure ? cause.snapshot : null;
|
||||
throw new ApktoolConfigurationFailure(
|
||||
"version_unresolved",
|
||||
"The selected apktool launcher did not report a usable version",
|
||||
{
|
||||
selected_command: selection.command,
|
||||
...(failure === undefined
|
||||
...(snapshot === null
|
||||
? {}
|
||||
: {
|
||||
exit_code: failure.code,
|
||||
stderr_excerpt: failure.stderr.slice(0, 512),
|
||||
exit_code: snapshot.exitCode ?? null,
|
||||
stderr_excerpt: snapshot.stderr.text.slice(0, 512),
|
||||
}),
|
||||
...(cause instanceof OwnedCommandFailure &&
|
||||
cause.reason === "output-limit"
|
||||
? { max_output_bytes: VERSION_MAX_OUTPUT_BYTES }
|
||||
: {}),
|
||||
},
|
||||
{ cause },
|
||||
{ cause, ...cleanupDetails },
|
||||
);
|
||||
}
|
||||
const identity = parseApktoolVersionOutput(stdout);
|
||||
|
||||
@@ -56,6 +56,7 @@ import { WindowsBatchCommandError } from "../process/WindowsBatchCommand.js";
|
||||
import {
|
||||
APKTOOL_COMMAND_ENV,
|
||||
ApktoolConfigurationFailure,
|
||||
type ApktoolProbeCleanup,
|
||||
apktoolConfigurationAvailability,
|
||||
apktoolInvocation,
|
||||
inspectApktoolClient,
|
||||
@@ -148,6 +149,19 @@ interface DecodeLimits {
|
||||
readonly maxOutputBytes: number;
|
||||
}
|
||||
|
||||
/** A probe whose launched processes could not be confirmed stopped. */
|
||||
const probeCleanupFailure = (
|
||||
operation: string,
|
||||
failure: ApktoolConfigurationFailure,
|
||||
cleanup: ApktoolProbeCleanup,
|
||||
): ProviderCleanupError =>
|
||||
new ProviderCleanupError(
|
||||
APKTOOL_PROVIDER_IDENTITY.id,
|
||||
cleanup.resources,
|
||||
{ reason: cleanup.reason, probe_failure: failure.message },
|
||||
{ operation, cause: failure },
|
||||
);
|
||||
|
||||
const runApktool = async (
|
||||
operation: string,
|
||||
selection: ApktoolCommandSelection,
|
||||
@@ -180,6 +194,9 @@ const runApktool = async (
|
||||
command: invocation.command,
|
||||
arguments: invocation.arguments,
|
||||
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
||||
// Apktool launchers are commonly interpreter scripts, so ownership is
|
||||
// proved by the run token rather than the launcher's argv prefix.
|
||||
expectedCommand: null,
|
||||
runId: randomUUID(),
|
||||
hostEnvironment: environment,
|
||||
},
|
||||
@@ -328,6 +345,10 @@ export class ApktoolProvider {
|
||||
private readonly workspaces = new Set<string>();
|
||||
private readonly removeWorkspace: (path: string) => Promise<void>;
|
||||
readonly #pendingCommandOwners = new Map<ProviderProcessSupervisor, string>();
|
||||
/** A version probe whose cleanup is unresolved is retried on close. */
|
||||
readonly #retainProbeOwner = (owner: ProviderProcessSupervisor): void => {
|
||||
this.#pendingCommandOwners.set(owner, "apktool version probe");
|
||||
};
|
||||
readonly #shutdown = new AbortController();
|
||||
readonly #active = new Set<Promise<void>>();
|
||||
#closing = false;
|
||||
@@ -378,7 +399,13 @@ export class ApktoolProvider {
|
||||
process.platform,
|
||||
signal,
|
||||
);
|
||||
await inspectApktoolClient(selection, signal, environment);
|
||||
await inspectApktoolClient(
|
||||
selection,
|
||||
signal,
|
||||
environment,
|
||||
process.platform,
|
||||
this.#retainProbeOwner,
|
||||
);
|
||||
throwIfCancelled("inspect_apktool_client", signal);
|
||||
return {
|
||||
status: "available",
|
||||
@@ -390,8 +417,15 @@ export class ApktoolProvider {
|
||||
},
|
||||
};
|
||||
} catch (cause) {
|
||||
if (cause instanceof ApktoolConfigurationFailure)
|
||||
if (cause instanceof ApktoolConfigurationFailure) {
|
||||
if (cause.cleanup !== undefined)
|
||||
throw probeCleanupFailure(
|
||||
"inspect_apktool_client",
|
||||
cause,
|
||||
cause.cleanup,
|
||||
);
|
||||
return apktoolConfigurationAvailability(cause);
|
||||
}
|
||||
throw cause;
|
||||
}
|
||||
}
|
||||
@@ -437,7 +471,13 @@ export class ApktoolProvider {
|
||||
process.platform,
|
||||
signal,
|
||||
);
|
||||
identity = await inspectApktoolClient(selection, signal, environment);
|
||||
identity = await inspectApktoolClient(
|
||||
selection,
|
||||
signal,
|
||||
environment,
|
||||
process.platform,
|
||||
this.#retainProbeOwner,
|
||||
);
|
||||
} catch (cause) {
|
||||
if (
|
||||
cause instanceof AnalysisCancelledError ||
|
||||
@@ -445,6 +485,10 @@ export class ApktoolProvider {
|
||||
)
|
||||
return err(cause);
|
||||
if (cause instanceof ApktoolConfigurationFailure) {
|
||||
if (cause.cleanup !== undefined)
|
||||
return err(
|
||||
probeCleanupFailure(request.operation, cause, cause.cleanup),
|
||||
);
|
||||
return err(
|
||||
providerConfigurationRefusal(
|
||||
APKTOOL_PROVIDER_IDENTITY.id,
|
||||
@@ -497,12 +541,14 @@ export class ApktoolProvider {
|
||||
async #drainAndClean(): Promise<void> {
|
||||
await Promise.all(this.#active);
|
||||
const failures: unknown[] = [];
|
||||
const retained: string[] = [];
|
||||
for (const [owner, root] of this.#pendingCommandOwners) {
|
||||
try {
|
||||
const stopped = await owner.stop();
|
||||
if (stopped.status === "incomplete") throw new Error(stopped.reason);
|
||||
this.#pendingCommandOwners.delete(owner);
|
||||
} catch (cause) {
|
||||
retained.push(root);
|
||||
failures.push(
|
||||
new Error(
|
||||
`apktool process cleanup remains incomplete for ${root}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
||||
@@ -511,8 +557,23 @@ export class ApktoolProvider {
|
||||
);
|
||||
}
|
||||
}
|
||||
// Ownership stays retained for a later close; report it as typed cleanup.
|
||||
if (failures.length > 0)
|
||||
throw new AggregateError(failures, "Apktool process cleanup failed");
|
||||
throw new ProviderCleanupError(
|
||||
APKTOOL_PROVIDER_IDENTITY.id,
|
||||
retained,
|
||||
{
|
||||
reason: failures
|
||||
.map((failure) =>
|
||||
failure instanceof Error ? failure.message : String(failure),
|
||||
)
|
||||
.join("; "),
|
||||
},
|
||||
{
|
||||
operation: "close",
|
||||
cause: new AggregateError(failures, "Apktool process cleanup failed"),
|
||||
},
|
||||
);
|
||||
for (const path of this.workspaces) {
|
||||
try {
|
||||
await this.removeWorkspace(path);
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { chmod, readFile, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import { promisify } from "node:util";
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
||||
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
|
||||
import { inspectApktoolClient } from "./ApktoolConfiguration.js";
|
||||
|
||||
/**
|
||||
* Only an exited process counts as stopped: it is gone, a zombie waiting to
|
||||
* be reaped, or absent from `ps`. A failed inspection is not proof of exit.
|
||||
*/
|
||||
const alive = async (pid: number): Promise<boolean> => {
|
||||
try {
|
||||
process.kill(pid, 0);
|
||||
} catch (cause: unknown) {
|
||||
if ((cause as NodeJS.ErrnoException).code === "ESRCH") return false;
|
||||
return true;
|
||||
}
|
||||
return promisify(execFile)("ps", ["-o", "stat=", "-p", `${pid}`]).then(
|
||||
({ stdout }) => {
|
||||
const state = stdout.trim();
|
||||
return state !== "" && !state.startsWith("Z");
|
||||
},
|
||||
// `ps` exits 1 when no process matches; any other failure is unknown.
|
||||
(cause: unknown) => (cause as { code?: unknown }).code !== 1,
|
||||
);
|
||||
};
|
||||
|
||||
const waitFor = async (check: () => Promise<boolean>, ms: number) => {
|
||||
const deadline = Date.now() + ms;
|
||||
while (Date.now() < deadline) {
|
||||
if (await check()) return true;
|
||||
await delay(25);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const readPids = async (path: string): Promise<readonly number[]> =>
|
||||
readFile(path, "utf8")
|
||||
.then((text) => JSON.parse(text) as number[])
|
||||
.catch(() => []);
|
||||
|
||||
// The interpreter is the test runtime itself, so its environment (and the
|
||||
// ownership run token) is readable on both Linux and macOS.
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"stops an interpreter launcher and its pipe-holding child when the probe is cancelled",
|
||||
async () => {
|
||||
const root = await createTestTempDirectory("rea-apktool-probe-");
|
||||
const pids = join(root, "pids.json");
|
||||
const launcher = join(root, "apktool");
|
||||
await writeFile(
|
||||
launcher,
|
||||
[
|
||||
`#!${process.execPath}`,
|
||||
'const { spawn } = require("node:child_process");',
|
||||
'const child = spawn(process.execPath, ["-e", "setInterval(() => {}, 1000)"], { stdio: "inherit" });',
|
||||
`require("node:fs").writeFileSync(${JSON.stringify(pids)}, JSON.stringify([process.pid, child.pid]));`,
|
||||
"setInterval(() => {}, 1000);",
|
||||
].join("\n"),
|
||||
);
|
||||
await chmod(launcher, 0o755);
|
||||
const controller = new AbortController();
|
||||
const started = performance.now();
|
||||
const probe = inspectApktoolClient(
|
||||
{ command: launcher, commandSource: "environment" },
|
||||
controller.signal,
|
||||
process.env,
|
||||
).catch((cause: unknown) => cause);
|
||||
try {
|
||||
expect(
|
||||
await waitFor(async () => (await readPids(pids)).length === 2, 10_000),
|
||||
).toBe(true);
|
||||
const launched = await readPids(pids);
|
||||
controller.abort();
|
||||
// A regressed probe never settles; bound the wait so cleanup still runs.
|
||||
const outcome = await Promise.race([
|
||||
probe,
|
||||
delay(15_000).then(() => "still pending"),
|
||||
]);
|
||||
expect(outcome).toBeInstanceOf(AnalysisCancelledError);
|
||||
expect(performance.now() - started).toBeLessThan(15_000);
|
||||
expect(
|
||||
await waitFor(
|
||||
async () =>
|
||||
(await Promise.all(launched.map(alive))).every((live) => !live),
|
||||
5_000,
|
||||
),
|
||||
).toBe(true);
|
||||
} finally {
|
||||
// A failed assertion must not leave the fixture's processes running.
|
||||
controller.abort();
|
||||
await Promise.race([probe, delay(10_000)]);
|
||||
for (const pid of await readPids(pids))
|
||||
if (await alive(pid))
|
||||
try {
|
||||
process.kill(pid, "SIGKILL");
|
||||
} catch {
|
||||
// Already exited between the check and the signal.
|
||||
}
|
||||
}
|
||||
},
|
||||
30_000,
|
||||
);
|
||||
@@ -0,0 +1,147 @@
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
AnalysisCancelledError,
|
||||
AnalysisTimeoutError,
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import {
|
||||
OwnedCommandFailure,
|
||||
runOwnedCommand,
|
||||
} from "../process/OwnedCommand.js";
|
||||
import type { ProviderProcessSupervisor } from "../process/ProviderProcess.js";
|
||||
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
||||
import {
|
||||
ApktoolConfigurationFailure,
|
||||
inspectApktoolClient,
|
||||
} from "./ApktoolConfiguration.js";
|
||||
import { ApktoolProvider } from "./ApktoolProvider.js";
|
||||
|
||||
vi.mock("../process/OwnedCommand.js", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../process/OwnedCommand.js")>()),
|
||||
runOwnedCommand: vi.fn(),
|
||||
}));
|
||||
afterEach(() => vi.mocked(runOwnedCommand).mockReset());
|
||||
|
||||
const selection = {
|
||||
command: "/opt/apktool/apktool",
|
||||
commandSource: "environment",
|
||||
} as const;
|
||||
const owner = {} as ProviderProcessSupervisor;
|
||||
|
||||
it("runs the version probe as an owned interpreter-script process group", async () => {
|
||||
vi.mocked(runOwnedCommand).mockResolvedValueOnce({
|
||||
stdout: { text: "2.9.3\n" },
|
||||
stderr: { text: "" },
|
||||
} as Awaited<ReturnType<typeof runOwnedCommand>>);
|
||||
await expect(
|
||||
inspectApktoolClient(selection, undefined, {}, "linux"),
|
||||
).resolves.toEqual({ version: "2.9.3" });
|
||||
expect(vi.mocked(runOwnedCommand).mock.lastCall?.[0]).toMatchObject({
|
||||
command: "/opt/apktool/apktool",
|
||||
arguments: ["--version"],
|
||||
expectedCommand: null,
|
||||
});
|
||||
expect(vi.mocked(runOwnedCommand).mock.lastCall?.[1]).toEqual({
|
||||
timeoutMs: 20_000,
|
||||
diagnosticBytes: 64 * 1024,
|
||||
});
|
||||
});
|
||||
|
||||
it("reports an expired version probe as a typed timeout", async () => {
|
||||
vi.mocked(runOwnedCommand).mockRejectedValueOnce(
|
||||
new OwnedCommandFailure("timeout", "Command deadline elapsed."),
|
||||
);
|
||||
const failure = await inspectApktoolClient(
|
||||
selection,
|
||||
undefined,
|
||||
{},
|
||||
"linux",
|
||||
).catch((cause: unknown) => cause);
|
||||
expect(failure).toBeInstanceOf(AnalysisTimeoutError);
|
||||
expect(projectAnalysisError(failure as AnalysisTimeoutError)).toMatchObject({
|
||||
code: "provider_timeout",
|
||||
category: "timeout",
|
||||
details: { timeout_ms: 20_000 },
|
||||
});
|
||||
});
|
||||
|
||||
it("retains an unresolved probe cleanup owner and reports the cleanup", async () => {
|
||||
vi.mocked(runOwnedCommand).mockRejectedValueOnce(
|
||||
new OwnedCommandFailure(
|
||||
"timeout",
|
||||
"Command deadline elapsed.",
|
||||
null,
|
||||
"cleanup incomplete",
|
||||
undefined,
|
||||
["pid:1"],
|
||||
owner,
|
||||
),
|
||||
);
|
||||
const retained: ProviderProcessSupervisor[] = [];
|
||||
const failure = await inspectApktoolClient(
|
||||
selection,
|
||||
undefined,
|
||||
{},
|
||||
"linux",
|
||||
(cleanupOwner) => retained.push(cleanupOwner),
|
||||
).catch((cause: unknown) => cause);
|
||||
expect(failure).toBeInstanceOf(AnalysisTimeoutError);
|
||||
expect(projectAnalysisError(failure as AnalysisTimeoutError)).toMatchObject({
|
||||
code: "cleanup_incomplete",
|
||||
});
|
||||
expect(retained).toEqual([owner]);
|
||||
});
|
||||
|
||||
it("reports a cancelled version probe as cancelled", async () => {
|
||||
vi.mocked(runOwnedCommand).mockRejectedValueOnce(
|
||||
new OwnedCommandFailure("cancelled", "Command cancelled."),
|
||||
);
|
||||
await expect(
|
||||
inspectApktoolClient(selection, undefined, {}, "linux"),
|
||||
).rejects.toBeInstanceOf(AnalysisCancelledError);
|
||||
});
|
||||
|
||||
it("keeps unresolved probe cleanup typed when the launcher overflows its output", async () => {
|
||||
const overflow = () =>
|
||||
new OwnedCommandFailure(
|
||||
"output-limit",
|
||||
"Command diagnostic output exceeded its complete-output budget.",
|
||||
null,
|
||||
"process group still running",
|
||||
undefined,
|
||||
["pid:7", "process-group:7"],
|
||||
owner,
|
||||
);
|
||||
vi.mocked(runOwnedCommand).mockRejectedValueOnce(overflow());
|
||||
const failure = await inspectApktoolClient(
|
||||
selection,
|
||||
undefined,
|
||||
{},
|
||||
"linux",
|
||||
).catch((cause: unknown) => cause);
|
||||
expect(failure).toBeInstanceOf(ApktoolConfigurationFailure);
|
||||
expect((failure as ApktoolConfigurationFailure).cleanup).toEqual({
|
||||
reason: "process group still running",
|
||||
resources: ["pid:7", "process-group:7"],
|
||||
});
|
||||
|
||||
// Both provider entry points report the unresolved processes as cleanup.
|
||||
const provider = new ApktoolProvider({
|
||||
environment: { REA_APKTOOL_COMMAND: "/opt/apktool/apktool" },
|
||||
});
|
||||
vi.mocked(runOwnedCommand).mockRejectedValueOnce(overflow());
|
||||
await expect(provider.inspectAvailability()).rejects.toBeInstanceOf(
|
||||
ProviderCleanupError,
|
||||
);
|
||||
vi.mocked(runOwnedCommand).mockRejectedValueOnce(overflow());
|
||||
const result = await provider.execute({
|
||||
operation: "decode_android_resources",
|
||||
input: {},
|
||||
} as never);
|
||||
expect(result.ok ? null : result.error).toBeInstanceOf(ProviderCleanupError);
|
||||
expect(result.ok ? null : projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "cleanup_incomplete",
|
||||
details: { resources: ["pid:7", "process-group:7"] },
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
stat,
|
||||
type FileHandle,
|
||||
} from "node:fs/promises";
|
||||
import { extname, isAbsolute, resolve } from "node:path";
|
||||
import { extname } from "node:path";
|
||||
|
||||
import { BinaryTargetError } from "../domain/configurationErrors.js";
|
||||
import {
|
||||
@@ -52,6 +52,7 @@ import {
|
||||
type ExecutableMetadata,
|
||||
} from "../domain/binaryTarget.js";
|
||||
import type { PeCodeViewRecord } from "../domain/binaryTargetTypes.js";
|
||||
import { absoluteCallerPath } from "../filesystem/callerPath.js";
|
||||
|
||||
const XML_PLIST_PROBE_CHUNK_BYTES = 64 * 1024;
|
||||
|
||||
@@ -80,7 +81,7 @@ export const parseBinaryTarget = async (
|
||||
const cwd = options.cwd ?? process.cwd();
|
||||
const hostArchitecture = options.hostArchitecture ?? process.arch;
|
||||
const { targetKind, formatHint, signal, architecture, entryPoint } = options;
|
||||
const candidate = isAbsolute(input) ? input : resolve(cwd, input);
|
||||
const candidate = absoluteCallerPath(input, { cwd });
|
||||
try {
|
||||
throwIfTargetResolutionCancelled(signal);
|
||||
await access(candidate, constants.R_OK);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CATALOG_IDENTITY } from "../catalogIdentity.js";
|
||||
import { PRODUCT_IDENTITY } from "../identity.js";
|
||||
import { ok } from "../domain/result.js";
|
||||
import type { DoctorHost } from "./Doctor.js";
|
||||
|
||||
/** Healthy recording host for focused doctor and projection tests. */
|
||||
@@ -14,7 +15,16 @@ export const createDoctorHostFixture = (
|
||||
linuxDistribution: () => Promise.resolve(undefined),
|
||||
validTarget: (path) => Promise.resolve(path.includes("Hopper")),
|
||||
executable: (path) => Promise.resolve(path.includes("Hopper")),
|
||||
supportedLinuxHopper: () => Promise.resolve(true),
|
||||
inspectLinuxHopper: () =>
|
||||
Promise.resolve(
|
||||
ok({
|
||||
sha256: "0".repeat(64),
|
||||
version: "fixture",
|
||||
primaryFingerprint: "0".repeat(40),
|
||||
signingFingerprint: "1".repeat(40),
|
||||
source: "signed_package_cache" as const,
|
||||
}),
|
||||
),
|
||||
linuxDemoRuntimeCheck: () =>
|
||||
Promise.resolve({
|
||||
name: "hopper-demo-runtime",
|
||||
|
||||
@@ -4,6 +4,8 @@ import { SUPPORTED_NODE_VERSION_PROSE } from "../domain/runtimeVersion.js";
|
||||
import type { ClientRegistrationStatus } from "./ClientRegistrationStatus.js";
|
||||
import { createDoctorHostFixture as host } from "./Doctor.fixture.js";
|
||||
import { runDoctor } from "./Doctor.js";
|
||||
import { err } from "../domain/result.js";
|
||||
import { HopperReleaseError } from "./HopperReleaseFeed.js";
|
||||
|
||||
describe("doctor runtime check", () => {
|
||||
it("reports Node 25 as unsupported", async () => {
|
||||
@@ -617,12 +619,20 @@ describe("doctor Linux and Hopper discovery", () => {
|
||||
hopperSetupSupported: true,
|
||||
}),
|
||||
executable: (candidate) => Promise.resolve(candidate === path),
|
||||
supportedLinuxHopper: () => Promise.resolve(false),
|
||||
inspectLinuxHopper: () =>
|
||||
Promise.resolve(
|
||||
err(
|
||||
new HopperReleaseError(
|
||||
"unsupported_hopper_build",
|
||||
"Unverified fixture build",
|
||||
),
|
||||
),
|
||||
),
|
||||
}),
|
||||
);
|
||||
expect(
|
||||
result.checks.find(({ name }) => name === "hopper-version")?.remediation,
|
||||
).toContain("Unset or update HOPPER_LAUNCHER_PATH");
|
||||
).toContain("Check HOPPER_LAUNCHER_PATH");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -19,11 +19,14 @@ import {
|
||||
macHopperRenamedLauncherCandidates,
|
||||
} from "./MacHopperPaths.js";
|
||||
import {
|
||||
linuxHopperBinarySupported,
|
||||
inspectLinuxHopperLauncher,
|
||||
linuxSharedLibrariesAvailable,
|
||||
readLinuxDistribution,
|
||||
type LinuxDistribution,
|
||||
} from "./LinuxHopper.js";
|
||||
import type { Result } from "../domain/result.js";
|
||||
import type { HopperReleaseError } from "./HopperReleaseFeed.js";
|
||||
import type { VerifiedLinuxHopperLauncher } from "./LinuxHopperPublisher.js";
|
||||
import {
|
||||
readInstalledSkillIdentity,
|
||||
type InstalledSkillIdentity,
|
||||
@@ -101,7 +104,9 @@ export interface DoctorHost {
|
||||
/** Route-specific target admission details, when supplied by the host. */
|
||||
inspectTarget?(path: string): Promise<DoctorCheck>;
|
||||
executable(path: string): Promise<boolean>;
|
||||
supportedLinuxHopper(path: string): Promise<boolean>;
|
||||
inspectLinuxHopper(
|
||||
path: string,
|
||||
): Promise<Result<VerifiedLinuxHopperLauncher, HopperReleaseError>>;
|
||||
linuxDemoRuntimeCheck(): Promise<DoctorCheck>;
|
||||
brewHopperPath(): Promise<string | undefined>;
|
||||
manualHopperPaths(): Promise<readonly string[]>;
|
||||
@@ -512,7 +517,7 @@ export const systemDoctorHost = (
|
||||
),
|
||||
linuxDemoRuntimeCheck:
|
||||
options.linuxDemoRuntimeCheck ?? uncomposedLinuxDemoRuntimeCheck,
|
||||
supportedLinuxHopper: linuxHopperBinarySupported,
|
||||
inspectLinuxHopper: (path) => inspectLinuxHopperLauncher(path, environment),
|
||||
async brewHopperPath() {
|
||||
return probeHomebrew(async (command) => {
|
||||
let caskroom: string;
|
||||
|
||||
@@ -209,17 +209,34 @@ const optionalHopperVersionCheck = async (
|
||||
hopperPath: string | undefined,
|
||||
): Promise<DoctorCheck | undefined> => {
|
||||
if (host.platform !== "linux" || hopperPath === undefined) return undefined;
|
||||
return check(
|
||||
"hopper-version",
|
||||
await host.supportedLinuxHopper(hopperPath),
|
||||
hopperPath,
|
||||
{
|
||||
remediation: unsupportedHopperRemediation(
|
||||
host.configuredHopperPath === hopperPath,
|
||||
),
|
||||
classification: "config_drift",
|
||||
},
|
||||
);
|
||||
const inspected = await host.inspectLinuxHopper(hopperPath);
|
||||
const buildCheck = check("hopper-version", inspected.ok, hopperPath, {
|
||||
remediation: unsupportedHopperRemediation(
|
||||
host.configuredHopperPath === hopperPath,
|
||||
),
|
||||
classification:
|
||||
!inspected.ok &&
|
||||
[
|
||||
"release_metadata",
|
||||
"download",
|
||||
"verification_unavailable",
|
||||
"cancelled",
|
||||
"cleanup_failed",
|
||||
].includes(inspected.error.reason)
|
||||
? "unknown"
|
||||
: "config_drift",
|
||||
});
|
||||
return {
|
||||
...buildCheck,
|
||||
details: inspected.ok
|
||||
? {
|
||||
reported_release_version: inspected.value.version,
|
||||
launcher_sha256: inspected.value.sha256,
|
||||
primary_fingerprint: inspected.value.primaryFingerprint,
|
||||
source: inspected.value.source,
|
||||
}
|
||||
: { reason: inspected.error.reason, message: inspected.error.message },
|
||||
};
|
||||
};
|
||||
|
||||
const optionalHopperDemoCheck = async (
|
||||
@@ -297,8 +314,8 @@ const providerDoctorChecks = (
|
||||
|
||||
const unsupportedHopperRemediation = (configured: boolean): string =>
|
||||
configured
|
||||
? "Unset or update HOPPER_LAUNCHER_PATH, install the Hopper build supported by this REA release, or update REA."
|
||||
: "Install the Hopper build supported by this REA release, or update REA for a newer Hopper build.";
|
||||
? "Check HOPPER_LAUNCHER_PATH and its publisher verification evidence. Run rea setup to install and retain an authenticated official Hopper package for offline use."
|
||||
: "Run rea setup to install and retain an authenticated official Hopper package for offline use.";
|
||||
|
||||
const parseMajor = (version: string | undefined): number =>
|
||||
Number.parseInt(version?.split(".")[0] ?? "0", 10);
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
/** Deep-analysis providers whose readiness can be selected explicitly by doctor. */
|
||||
export const DOCTOR_PROVIDER_IDS = ["hopper", "ghidra", "ida", "jadx"] as const;
|
||||
export const DOCTOR_PROVIDER_IDS = [
|
||||
"hopper",
|
||||
"ghidra",
|
||||
"ida",
|
||||
"jadx",
|
||||
"kuna",
|
||||
] as const;
|
||||
@@ -95,6 +95,46 @@ const firstAnalysisCancellation = <Value>(
|
||||
* Direct callers use `execute`; adapters that own validation use
|
||||
* `executeValidated` so an MCP input is parsed exactly once.
|
||||
*/
|
||||
|
||||
const NO_PSEUDOCODE =
|
||||
"The provider reports no pseudocode for this procedure; the batch limitations for procedure_pseudo_code say why.";
|
||||
|
||||
/** One batch item from its pseudocode observation, keeping null distinct from unreadable output. */
|
||||
const batchPseudocodeItem = (
|
||||
address: string,
|
||||
procedure: BatchProcedureIdentity,
|
||||
observed: Result<AnalysisExecution, AnalysisError>,
|
||||
): BatchDecompileItem => {
|
||||
const failed = (error: AnalysisError): BatchDecompileItem => ({
|
||||
address,
|
||||
procedure,
|
||||
status: "error",
|
||||
error: projectAnalysisError(error),
|
||||
});
|
||||
if (!observed.ok) return failed(observed.error);
|
||||
const pseudocode = observed.value.result;
|
||||
// The contract's null is the provider's own answer that this procedure has
|
||||
// no pseudocode (an import slot, a failed body); the provider's reason is
|
||||
// in the batch limitations, so it is not reported as unreadable output.
|
||||
if (pseudocode === null)
|
||||
return failed(
|
||||
new AnalysisCapabilityUnavailableError(
|
||||
observed.value.provider.id,
|
||||
"procedure_pseudo_code",
|
||||
NO_PSEUDOCODE,
|
||||
{ userMessage: NO_PSEUDOCODE },
|
||||
),
|
||||
);
|
||||
if (typeof pseudocode !== "string" || pseudocode.length === 0)
|
||||
return failed(
|
||||
new AnalysisOutputError(
|
||||
"procedure_pseudo_code",
|
||||
"provider returned empty pseudocode",
|
||||
),
|
||||
);
|
||||
return { address, procedure, status: "ok", pseudocode };
|
||||
};
|
||||
|
||||
export class EnhancedTools {
|
||||
constructor(private readonly analysis: AnalysisOperationPort) {}
|
||||
|
||||
@@ -375,7 +415,7 @@ export class EnhancedTools {
|
||||
): Promise<Result<BatchDecompileItem, AnalysisCancelledError>[]> {
|
||||
return Promise.all(
|
||||
ready.map(async ({ address, procedure, providerProcedure }) => {
|
||||
const result = await this.#call(
|
||||
const result = await this.#observe(
|
||||
"procedure_pseudo_code",
|
||||
{ procedure: providerProcedure },
|
||||
signal,
|
||||
@@ -383,32 +423,7 @@ export class EnhancedTools {
|
||||
);
|
||||
if (!result.ok && isAnalysisCancellation(result.error))
|
||||
return err(result.error);
|
||||
const item: BatchDecompileItem = !result.ok
|
||||
? {
|
||||
address,
|
||||
procedure,
|
||||
status: "error",
|
||||
error: projectAnalysisError(result.error),
|
||||
}
|
||||
: typeof result.value !== "string" || result.value.length === 0
|
||||
? {
|
||||
address,
|
||||
procedure,
|
||||
status: "error",
|
||||
error: projectAnalysisError(
|
||||
new AnalysisOutputError(
|
||||
"procedure_pseudo_code",
|
||||
"provider returned empty pseudocode",
|
||||
),
|
||||
),
|
||||
}
|
||||
: {
|
||||
address,
|
||||
procedure,
|
||||
status: "ok",
|
||||
pseudocode: result.value,
|
||||
};
|
||||
return ok(item);
|
||||
return ok(batchPseudocodeItem(address, procedure, result));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,23 @@ export const HOPPER_DOWNLOAD_BYTES = 100_000_000;
|
||||
/** Bound observed response bytes before retaining them, including chunked bodies. */
|
||||
export const downloadHopperPackage = async (
|
||||
url: string,
|
||||
options: { readonly signal?: AbortSignal } = {},
|
||||
options: {
|
||||
readonly signal?: AbortSignal;
|
||||
readonly maxBytes?: number;
|
||||
readonly timeoutMs?: number;
|
||||
} = {},
|
||||
): Promise<{ readonly ok: boolean; readonly bytes: Uint8Array }> => {
|
||||
const deadline = AbortSignal.timeout(120_000);
|
||||
const timeoutMs = options.timeoutMs ?? 120_000;
|
||||
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 120_000)
|
||||
throw new RangeError("Invalid Hopper response time budget");
|
||||
const deadline = AbortSignal.timeout(timeoutMs);
|
||||
const maxBytes = options.maxBytes ?? HOPPER_DOWNLOAD_BYTES;
|
||||
if (
|
||||
!Number.isSafeInteger(maxBytes) ||
|
||||
maxBytes < 1 ||
|
||||
maxBytes > HOPPER_DOWNLOAD_BYTES
|
||||
)
|
||||
throw new RangeError("Invalid Hopper response byte budget");
|
||||
const response = await fetch(url, {
|
||||
headers: { accept: "application/json", "user-agent": "rea-installer" },
|
||||
signal:
|
||||
@@ -17,7 +31,7 @@ export const downloadHopperPackage = async (
|
||||
const refused = { ok: false, bytes: new Uint8Array() };
|
||||
if (
|
||||
!response.ok ||
|
||||
Number(response.headers.get("content-length")) > HOPPER_DOWNLOAD_BYTES
|
||||
Number(response.headers.get("content-length")) > maxBytes
|
||||
) {
|
||||
await response.body?.cancel();
|
||||
return refused;
|
||||
@@ -30,7 +44,7 @@ export const downloadHopperPackage = async (
|
||||
while (true) {
|
||||
const chunk = await reader.read();
|
||||
if (chunk.done) return { ok: true, bytes: Buffer.concat(chunks, bytes) };
|
||||
if (chunk.value.byteLength > HOPPER_DOWNLOAD_BYTES - bytes) {
|
||||
if (chunk.value.byteLength > maxBytes - bytes) {
|
||||
await reader.cancel();
|
||||
return refused;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { parseLinuxHopperReleases } from "./HopperReleaseFeed.js";
|
||||
|
||||
const release = {
|
||||
version: "99.2.1",
|
||||
filename:
|
||||
"https://www.hopperapp.com:443/downloader/public/Hopper-99.2.1-Linux-demo.deb",
|
||||
file_length: "123",
|
||||
file_hash: "a".repeat(40),
|
||||
main_exe_hash: "b".repeat(64),
|
||||
signature: "AQ==",
|
||||
public: "1",
|
||||
beta: "0",
|
||||
published_at: "preserved vendor field",
|
||||
};
|
||||
|
||||
describe("Linux Hopper release feed boundary", () => {
|
||||
it("preserves future release identity and partial platform facts", () => {
|
||||
const parsed = parseLinuxHopperReleases({
|
||||
"Ubuntu / Mint": release,
|
||||
"OS X": { signature: "Sparkle DSA" },
|
||||
});
|
||||
expect(parsed).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
deb: { ok: true, value: release },
|
||||
rpm: { ok: false },
|
||||
arch: { ok: false },
|
||||
},
|
||||
});
|
||||
if (!parsed.ok || !parsed.value.deb.ok) throw new Error("Missing release");
|
||||
expect(parsed.value.deb.value.filename).toBe(release.filename);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ signature: undefined },
|
||||
{ signature: "AQ==garbage" },
|
||||
{ main_exe_hash: "b".repeat(40) },
|
||||
{ file_length: "100000001" },
|
||||
{ file_length: "NaN" },
|
||||
{ public: "0" },
|
||||
{ beta: "1" },
|
||||
{
|
||||
filename:
|
||||
"https://other.example/downloader/public/Hopper-99.2.1-Linux-demo.deb",
|
||||
},
|
||||
{ filename: release.filename + "?token=caller" },
|
||||
{
|
||||
filename: release.filename.replace("https://", "https://user:password@"),
|
||||
},
|
||||
{ filename: release.filename.replace(".deb", ".rpm") },
|
||||
{ filename: release.filename.replace("demo.deb", "full.deb") },
|
||||
])(
|
||||
"rejects metadata outside the selected public package contract: %j",
|
||||
(changes) => {
|
||||
expect(
|
||||
parseLinuxHopperReleases({
|
||||
"Ubuntu / Mint": { ...release, ...changes },
|
||||
}),
|
||||
).toMatchObject({
|
||||
ok: true,
|
||||
value: { deb: { ok: false, error: { reason: "release_metadata" } } },
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it.each([null, [], "html error page"])(
|
||||
"keeps malformed feed roots unknown",
|
||||
(raw) => {
|
||||
expect(parseLinuxHopperReleases(raw)).toMatchObject({
|
||||
ok: false,
|
||||
error: { reason: "release_metadata" },
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,125 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import { HOPPER_DOWNLOAD_BYTES } from "./HopperDownload.js";
|
||||
|
||||
/** Vendor endpoints, shared by installation and existing-build inspection. */
|
||||
export const HOPPER_RELEASES_URL =
|
||||
"https://www.hopperapp.com/include/files-api.php?request=releases&public=true";
|
||||
export const HOPPER_PUBLIC_KEY_URL =
|
||||
"https://www.hopperapp.com/hopper-public-key.asc";
|
||||
export const HOPPER_DOWNLOAD_PREFIX =
|
||||
"https://www.hopperapp.com:443/downloader/public/";
|
||||
|
||||
/** Stable publisher identity; signing subkeys are admitted through this primary. */
|
||||
export const HOPPER_LINUX_PRIMARY_FINGERPRINT =
|
||||
"7C2D73BAFAF5B9A710A69DA1A26DF815099B1BCD";
|
||||
|
||||
export type LinuxPackageFamily = "deb" | "rpm" | "arch";
|
||||
const platforms = {
|
||||
deb: "Ubuntu / Mint",
|
||||
rpm: "Fedora",
|
||||
arch: "Arch",
|
||||
} as const;
|
||||
const suffixes = { deb: ".deb", rpm: ".rpm", arch: ".pkg.tar.xz" } as const;
|
||||
|
||||
export class HopperReleaseError extends Error {
|
||||
readonly _tag = "HopperReleaseError";
|
||||
constructor(
|
||||
readonly reason:
|
||||
| "release_metadata"
|
||||
| "download"
|
||||
| "integrity"
|
||||
| "publisher_verification_failed"
|
||||
| "verification_unavailable"
|
||||
| "unsupported_hopper_build"
|
||||
| "cancelled"
|
||||
| "cleanup_failed"
|
||||
| "cache_missing",
|
||||
message: string,
|
||||
options?: ErrorOptions,
|
||||
) {
|
||||
super(message, options);
|
||||
this.name = this._tag;
|
||||
}
|
||||
}
|
||||
|
||||
const sha256 = z.string().regex(/^[a-f0-9]{64}$/u);
|
||||
const releaseSchema = z
|
||||
.object({
|
||||
version: z.string().min(1),
|
||||
filename: z.string().url(),
|
||||
file_length: z
|
||||
.string()
|
||||
.regex(/^[1-9]\d*$/u)
|
||||
.refine((text) => {
|
||||
const count = Number(text);
|
||||
return Number.isSafeInteger(count) && count <= HOPPER_DOWNLOAD_BYTES;
|
||||
}),
|
||||
file_hash: z.string().regex(/^[a-f0-9]{40}$/u),
|
||||
main_exe_hash: sha256,
|
||||
signature: z
|
||||
.string()
|
||||
.min(1)
|
||||
.refine(
|
||||
(text) => Buffer.from(text, "base64").toString("base64") === text,
|
||||
),
|
||||
public: z.literal("1"),
|
||||
beta: z.literal("0"),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/** Parsed once at the feed boundary; preserve the vendor's complete release row. */
|
||||
export type LinuxHopperRelease = z.infer<typeof releaseSchema>;
|
||||
export type LinuxHopperReleaseFeed = Readonly<
|
||||
Record<LinuxPackageFamily, Result<LinuxHopperRelease, HopperReleaseError>>
|
||||
>;
|
||||
|
||||
export const parseLinuxHopperRelease = (
|
||||
raw: unknown,
|
||||
family: LinuxPackageFamily,
|
||||
): Result<LinuxHopperRelease, HopperReleaseError> => {
|
||||
const parsed = releaseSchema.safeParse(raw);
|
||||
if (!parsed.success)
|
||||
return err(
|
||||
new HopperReleaseError(
|
||||
"release_metadata",
|
||||
"The Hopper release omitted valid package identity or signature metadata.",
|
||||
),
|
||||
);
|
||||
const url = new URL(parsed.data.filename);
|
||||
if (
|
||||
url.origin !== "https://www.hopperapp.com" ||
|
||||
url.username !== "" ||
|
||||
url.password !== "" ||
|
||||
url.search !== "" ||
|
||||
url.hash !== "" ||
|
||||
!url.pathname.startsWith("/downloader/public/Hopper-") ||
|
||||
!url.pathname.endsWith(`-Linux-demo${suffixes[family]}`)
|
||||
)
|
||||
return err(
|
||||
new HopperReleaseError(
|
||||
"release_metadata",
|
||||
"The Hopper release is outside the official public Linux demo channel.",
|
||||
),
|
||||
);
|
||||
return ok(parsed.data);
|
||||
};
|
||||
|
||||
export const parseLinuxHopperReleases = (
|
||||
raw: unknown,
|
||||
): Result<LinuxHopperReleaseFeed, HopperReleaseError> => {
|
||||
const feed = z.record(z.string(), z.unknown()).safeParse(raw);
|
||||
if (!feed.success)
|
||||
return err(
|
||||
new HopperReleaseError(
|
||||
"release_metadata",
|
||||
"The Hopper releases response is not an object.",
|
||||
),
|
||||
);
|
||||
return ok({
|
||||
deb: parseLinuxHopperRelease(feed.data[platforms.deb], "deb"),
|
||||
rpm: parseLinuxHopperRelease(feed.data[platforms.rpm], "rpm"),
|
||||
arch: parseLinuxHopperRelease(feed.data[platforms.arch], "arch"),
|
||||
});
|
||||
};
|
||||
Loaded 100 of 429 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user