mirror of
https://github.com/morluto/rea.git
synced 2026-11-22 14:35:45 +00:00
fix(javascript): preserve loader authority for exact suffixes (#9477)
* 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>
This commit is contained in:
1 parent
78a84d75c0
commit
b46f4fcebd
112 files changed
+5156
-797
No files matched your search
@@ -8,7 +8,11 @@ import {
|
||||
addSemanticGraphRelation,
|
||||
addSemanticGraphUnknown,
|
||||
} from "./JavaScriptSemanticGraphConstruction.js";
|
||||
import { unknownSemanticEvidence } from "./JavaScriptSemanticGraphEvidence.js";
|
||||
import {
|
||||
unknownSemanticEvidence,
|
||||
builtinSemanticNode,
|
||||
builtinSemanticRelation,
|
||||
} from "./JavaScriptSemanticGraphEvidence.js";
|
||||
import {
|
||||
projectSemanticResultBindings,
|
||||
type SemanticFlowProjectionContext,
|
||||
@@ -62,13 +66,13 @@ const addChildProcessNode = (
|
||||
spawn.ownerCallableId === null
|
||||
? null
|
||||
: (context.callableNodes.get(spawn.ownerCallableId)?.node_id ?? null),
|
||||
properties: {
|
||||
...builtinSemanticNode(context.file, spawn, {
|
||||
argv_count: spawn.argvCount,
|
||||
command: spawn.command,
|
||||
environment_supplied: spawn.environmentSupplied,
|
||||
method: spawn.method,
|
||||
stdio_mode: spawn.stdioMode,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
const projectSpawn = (
|
||||
@@ -77,19 +81,38 @@ const projectSpawn = (
|
||||
child: JavaScriptSemanticGraphNode,
|
||||
): void => {
|
||||
const callSite = context.callSiteAt(spawn.location);
|
||||
const authority = builtinSemanticRelation(
|
||||
context.file,
|
||||
spawn,
|
||||
spawn.resolution === "complete" ? "resolved" : "candidate",
|
||||
);
|
||||
const candidateEvidence = authority.evidence;
|
||||
addSemanticGraphRelation(context.state, {
|
||||
source: callSite,
|
||||
target: child,
|
||||
relation: "spawns",
|
||||
resolution: spawn.resolution === "complete" ? "resolved" : "candidate",
|
||||
...authority,
|
||||
...(candidateEvidence === undefined
|
||||
? {}
|
||||
: {
|
||||
properties: { builtin_authority: "candidate" },
|
||||
}),
|
||||
});
|
||||
projectSemanticResultBindings(context, child, spawn.projectedResultBindings);
|
||||
projectSemanticResultBindings(
|
||||
context,
|
||||
child,
|
||||
spawn.projectedResultBindings,
|
||||
candidateEvidence,
|
||||
);
|
||||
if (spawn.argvCount !== null)
|
||||
addSemanticGraphRelation(context.state, {
|
||||
source: callSite,
|
||||
target: child,
|
||||
relation: "supplies-argv",
|
||||
resolution: "resolved",
|
||||
resolution: candidateEvidence === undefined ? "resolved" : "candidate",
|
||||
...(candidateEvidence === undefined
|
||||
? {}
|
||||
: { evidence: candidateEvidence }),
|
||||
properties: { argument_count: spawn.argvCount },
|
||||
});
|
||||
if (spawn.environmentSupplied)
|
||||
@@ -97,14 +120,21 @@ const projectSpawn = (
|
||||
source: callSite,
|
||||
target: child,
|
||||
relation: "supplies-env",
|
||||
resolution: "resolved",
|
||||
resolution: candidateEvidence === undefined ? "resolved" : "candidate",
|
||||
...(candidateEvidence === undefined
|
||||
? {}
|
||||
: { evidence: candidateEvidence }),
|
||||
});
|
||||
const stdio = addStdioNode(context, spawn, child);
|
||||
addSemanticGraphRelation(context.state, {
|
||||
source: child,
|
||||
target: stdio,
|
||||
relation: "connects-stdio",
|
||||
resolution: spawn.stdioMode === "dynamic" ? "candidate" : "resolved",
|
||||
resolution:
|
||||
candidateEvidence !== undefined || spawn.stdioMode === "dynamic"
|
||||
? "candidate"
|
||||
: "resolved",
|
||||
...(candidateEvidence === undefined ? {} : { evidence: candidateEvidence }),
|
||||
});
|
||||
if (spawn.stdioMode === "dynamic")
|
||||
addChildUnknown({
|
||||
@@ -116,6 +146,16 @@ const projectSpawn = (
|
||||
detail: `Static ${spawn.method} stdio options remain unresolved.`,
|
||||
candidateNodeIds: [],
|
||||
});
|
||||
if (candidateEvidence !== undefined)
|
||||
addChildUnknown({
|
||||
context,
|
||||
node: child,
|
||||
location: spawn.location,
|
||||
relationKinds: ["spawns"],
|
||||
detail:
|
||||
"The child-process identity is conditional on loader or mutation facts.",
|
||||
candidateNodeIds: [child.node_id],
|
||||
});
|
||||
if (spawn.resolution !== "complete")
|
||||
addChildUnknown({
|
||||
context,
|
||||
@@ -138,7 +178,9 @@ const addStdioNode = (
|
||||
location: spawn.location,
|
||||
label: spawn.stdioMode,
|
||||
functionNodeId: child.function_node_id,
|
||||
properties: { mode: spawn.stdioMode },
|
||||
...builtinSemanticNode(context.file, spawn, {
|
||||
mode: spawn.stdioMode,
|
||||
}),
|
||||
});
|
||||
|
||||
const projectInteraction = (
|
||||
@@ -146,6 +188,12 @@ const projectInteraction = (
|
||||
interaction: JavaScriptSemanticChildProcessInteraction,
|
||||
processNodes: ReadonlyMap<string, JavaScriptSemanticGraphNode>,
|
||||
): void => {
|
||||
const authority = builtinSemanticRelation(
|
||||
context.file,
|
||||
interaction,
|
||||
interaction.resolution === "complete" ? "resolved" : "candidate",
|
||||
);
|
||||
const candidateEvidence = authority.evidence;
|
||||
const children = interaction.linkedProcessIds.flatMap((identifier) => {
|
||||
const child = processNodes.get(identifier);
|
||||
return child === undefined ? [] : [child];
|
||||
@@ -164,8 +212,12 @@ const projectInteraction = (
|
||||
: interaction.eventName === "exit"
|
||||
? "listens-exit"
|
||||
: "listens-error",
|
||||
resolution:
|
||||
interaction.resolution === "complete" ? "resolved" : "candidate",
|
||||
...authority,
|
||||
...(candidateEvidence === undefined
|
||||
? {}
|
||||
: {
|
||||
properties: { builtin_authority: "candidate" },
|
||||
}),
|
||||
});
|
||||
if (interaction.resolution !== "complete")
|
||||
addChildUnknown({
|
||||
@@ -198,10 +250,10 @@ const addChildListenerNode = (
|
||||
? null
|
||||
: (context.callableNodes.get(interaction.ownerCallableId)?.node_id ??
|
||||
null),
|
||||
properties: {
|
||||
...builtinSemanticNode(context.file, interaction, {
|
||||
event_name: interaction.eventName,
|
||||
method: interaction.method,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
const addSignalNode = (
|
||||
@@ -218,7 +270,9 @@ const addSignalNode = (
|
||||
? null
|
||||
: (context.callableNodes.get(interaction.ownerCallableId)?.node_id ??
|
||||
null),
|
||||
properties: { signal_name: interaction.signalName },
|
||||
...builtinSemanticNode(context.file, interaction, {
|
||||
signal_name: interaction.signalName,
|
||||
}),
|
||||
});
|
||||
|
||||
const addChildUnknown = (input: ChildUnknownInput): void => {
|
||||
|
||||
Reference in new issue
Block a user