mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
Link original DEX native declarations to per-ABI function exports and relocated static JNI table candidates through shared CLI/MCP workflows. Preserve global attribution ambiguity, exact provenance, partial coverage and retained Evidence; default MCP delivery to bounded summaries with filtered/batch pages. Use one immutable ELF relocation decoder with streaming IL2CPP materialization, cooperative bounded export/version parsing and bounded JNI state. Reuse validated session inventories without loading target libraries or executing JNI code. Validation: relevant type/lint/build and parser/domain/public CLI/MCP regressions; genuine four-ABI NDK fixtures and independent library/slot oracles; actual JDK/JADX Conscrypt workflows with retained-source removal. Full measurements and limitations are recorded in docs/verification/android-jni-bindings-2026-10-27.md. Closes #6403.
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import type { ExecutionOptions } from "../AnalysisProvider.js";
|
|
import type { AndroidAnalysisService } from "./AndroidAnalysisService.js";
|
|
import {
|
|
requireAnalysisViewRetention,
|
|
projectRetainedAnalysis,
|
|
type AnalysisViewRetention,
|
|
} from "../analysisView/AnalysisViewService.js";
|
|
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
|
import { androidJniInspectionInputSchema } from "../../domain/android/androidAnalysis.js";
|
|
import type { Evidence } from "../../domain/evidence.js";
|
|
import type { Result } from "../../domain/result.js";
|
|
import { parseAnalysisInput } from "../AnalysisInput.js";
|
|
|
|
/** Keep global attribution facts retained while delivering only the requested view. */
|
|
export const inspectAndroidJniBindings = async (
|
|
service: AndroidAnalysisService,
|
|
rawInput: unknown,
|
|
retention: AnalysisViewRetention,
|
|
options?: ExecutionOptions,
|
|
): Promise<Result<Evidence, AnalysisError>> => {
|
|
const operation = "inspect_android_jni_bindings";
|
|
const parsed = parseAnalysisInput(
|
|
operation,
|
|
rawInput,
|
|
androidJniInspectionInputSchema,
|
|
options?.signal,
|
|
);
|
|
if (!parsed.ok) return parsed;
|
|
const { detail, view, ...input } = parsed.value;
|
|
if (detail === "summary") {
|
|
const ready = requireAnalysisViewRetention(operation, retention);
|
|
if (!ready.ok) return ready;
|
|
}
|
|
const executed = await service.execute(operation, input, options);
|
|
return !executed.ok || detail !== "summary"
|
|
? executed
|
|
: projectRetainedAnalysis(
|
|
executed.value,
|
|
retention,
|
|
view ?? { kind: "summary" },
|
|
);
|
|
};
|