mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
* fix(javascript): require exact loader suffix case * fix(javascript): share exact loader mode across import resolution * test(process): align symlink fixture with filesystem checkpoints * test(javascript): normalize the module resolution oracle path separators * test(frida): assert the CLI spawn Evidence contract * test(mcp): use an unsupported analysis-view parent * test(browser): separate source-location line bounds from parity * fix(javascript): preserve uncertain loader provenance * test(javascript): cover uncertain require resolution * fix(javascript): retain conditional Electron evidence * fix(javascript): preserve timed semantic provenance * fix(javascript): retain conditional builtin effects * test(javascript): distinguish bundled host authority * fix(javascript): preserve nested loader invocation identity * test(javascript): qualify Electron fixture authority * fix(javascript): preserve loader invocation authority * fix(javascript): respect source order for resolver escapes * fix(javascript): check nested loader callable mutations * fix(javascript): retain conditional constructor requests * fix(reference): retain constructor loader relationships * fix(reference): follow nested loader callable paths * refactor(javascript): share callable mutation interpretation * fix(javascript): require exact package loader suffixes * refactor(javascript): unify conditional relation evidence * refactor(javascript): unify conditional node evidence * fix(javascript): retain unknown authority for mixed case sources * fix(javascript): preserve loader uncertainty for dotfiles * fix(reference): classify javascript suffix dotfiles * test(reference): cover suffix dotfiles through cli * fix(javascript): retain equivalent conditional built-in origins * fix(javascript): preserve wrapped resolver operation * fix(javascript): retain nested conditional built-in receivers * test(javascript): declare CommonJS in native addon fixtures * fix(javascript): retain wrapped resolver candidates * style: format merged native command schema * fix(javascript): preserve uncertain loader authority * test(javascript): require candidate preload evidence * test(javascript): cover reference loader member writes --------- Co-authored-by: ShuaixinHuang <1836656514@qq.com>
102 lines
3.6 KiB
TypeScript
102 lines
3.6 KiB
TypeScript
import type { ElectronCallPath } from "../../domain/javascript/electronStaticAnalysisTypes.js";
|
|
import type { JavaScriptArtifactFile } from "../../domain/javascript/javascriptArtifactFiles.js";
|
|
import { electronCallPathId } from "./ElectronCallPathIdentity.js";
|
|
import {
|
|
addSemanticGraphRelation,
|
|
retainSemanticGraphNode,
|
|
type SemanticGraphProjectionState,
|
|
} from "./JavaScriptSemanticGraphConstruction.js";
|
|
import { inferredSemanticEvidenceAt } from "./JavaScriptSemanticGraphEvidence.js";
|
|
import { ELECTRON_CANDIDATE_LIMITATION } from "./ElectronBoundaryGraphContext.js";
|
|
|
|
/** Give discovered process-boundary paths budget before bulk library definitions. */
|
|
export function* projectElectronSemanticCallPaths(
|
|
file: JavaScriptArtifactFile,
|
|
paths: readonly ElectronCallPath[],
|
|
state: SemanticGraphProjectionState,
|
|
): Generator<void, void> {
|
|
for (const path of paths) {
|
|
yield;
|
|
const pathId = electronCallPathId(file.path, path);
|
|
let previous: ReturnType<typeof retainSemanticGraphNode> = null;
|
|
let previousKind: ElectronCallPath["steps"][number]["kind"] | undefined;
|
|
for (const [index, step] of path.steps.entries()) {
|
|
const inferred = inferredSemanticEvidenceAt(file, step.location);
|
|
const candidateEvidence =
|
|
path.loader_authority === "candidate"
|
|
? {
|
|
...inferred,
|
|
confidence: "low" as const,
|
|
limitations: [
|
|
...inferred.limitations,
|
|
ELECTRON_CANDIDATE_LIMITATION,
|
|
],
|
|
}
|
|
: undefined;
|
|
const node = retainSemanticGraphNode(state, file, {
|
|
kind:
|
|
step.kind === "function"
|
|
? "function"
|
|
: step.kind === "exposure"
|
|
? "boundary"
|
|
: "call-site",
|
|
roleKey: `electron-path:${pathId}:${String(index)}`,
|
|
location: step.location,
|
|
label: step.label,
|
|
functionNodeId: null,
|
|
...(candidateEvidence === undefined
|
|
? {}
|
|
: { evidence: candidateEvidence }),
|
|
properties: {
|
|
path_id: pathId,
|
|
entry: path.entry,
|
|
...(path.entry_path === undefined
|
|
? {}
|
|
: { entry_path: [...path.entry_path] }),
|
|
channel: path.channel,
|
|
terminal: path.terminal,
|
|
...(path.loader_authority === "candidate"
|
|
? { loader_authority: "candidate" }
|
|
: {}),
|
|
step_kind: step.kind,
|
|
resolution: "candidate",
|
|
conditions: path.conditions.map((c) => ({
|
|
expression: c.expression,
|
|
location: {
|
|
start: { ...c.location.start },
|
|
end: { ...c.location.end },
|
|
},
|
|
})),
|
|
},
|
|
});
|
|
if (index === 0 && node !== null) state.roots.add(node.node_id);
|
|
addSemanticGraphRelation(state, {
|
|
source: previous,
|
|
target: node,
|
|
relation:
|
|
previousKind === "ipc"
|
|
? "registers-listener"
|
|
: previousKind === "exposure" || previousKind === "factory"
|
|
? "aliases"
|
|
: "calls",
|
|
resolution: "candidate",
|
|
evidence: candidateEvidence ?? inferred,
|
|
properties: {
|
|
path_id: pathId,
|
|
entry: path.entry,
|
|
...(path.entry_path === undefined
|
|
? {}
|
|
: { entry_path: [...path.entry_path] }),
|
|
channel: path.channel,
|
|
basis: "lexical-wrapper-substitution",
|
|
...(path.loader_authority === "candidate"
|
|
? { loader_authority: "candidate" }
|
|
: {}),
|
|
},
|
|
});
|
|
previous = node;
|
|
previousKind = step.kind;
|
|
}
|
|
}
|
|
}
|