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:
morlutoandShuaixinHuang authored and GitHub committed 2026-11-09 13:21:24 +08:00
1 parent 78a84d75c0
commit b46f4fcebd
112 files changed
+5156 -797

No files matched your search

@@ -33,8 +33,29 @@ export interface ElectronGraphEdgeInput {
readonly properties: Readonly<Record<string, unknown>>;
readonly confidence?: "high" | "medium" | "low";
readonly limitations?: readonly string[];
readonly loaderAuthority?: "candidate" | undefined;
}
/** Candidate syntax does not establish that the receiver is Electron. */
export const ELECTRON_CANDIDATE_LIMITATION =
"The Electron module loader is unknown, so this relationship is only a candidate.";
/** Preserve syntax with uncertainty when its Electron receiver is unproven. */
export const electronFindingEvidence = (
input: Parameters<typeof astObservationEvidence>[0],
loaderAuthority: "candidate" | undefined,
) =>
loaderAuthority === "candidate"
? staticInferenceEvidence({
...input,
confidence: "low",
limitations: [
...(input.limitations ?? []),
ELECTRON_CANDIDATE_LIMITATION,
],
})
: astObservationEvidence(input);
/** Resolve the file or recovered bundle module that owns one finding. */
export const electronFindingSourceNode = (
context: JavaScriptArtifactGraphContext,
@@ -69,17 +90,25 @@ export const addElectronAstEdge = (
source_node_id: input.source.node_id,
target_node_id: input.target.node_id,
relation: input.relation,
properties: input.properties,
evidence: astObservationEvidence({
sha256: input.file.sha256,
path: input.file.path,
range: input.range,
operation: input.operation,
coverage: input.coverage,
...(input.limitations === undefined
? {}
: { limitations: input.limitations }),
}),
properties: {
...input.properties,
...(input.loaderAuthority === "candidate"
? { loader_authority: "candidate" }
: {}),
},
evidence: electronFindingEvidence(
{
sha256: input.file.sha256,
path: input.file.path,
range: input.range,
operation: input.operation,
coverage: input.coverage,
...(input.limitations === undefined
? {}
: { limitations: input.limitations }),
},
input.loaderAuthority,
),
});
};
@@ -92,19 +121,33 @@ export const addElectronInferenceEdge = (
source_node_id: input.source.node_id,
target_node_id: input.target.node_id,
relation: input.relation,
properties: input.properties,
properties: {
...input.properties,
...(input.loaderAuthority === "candidate"
? { loader_authority: "candidate" }
: {}),
},
evidence: staticInferenceEvidence({
sha256: input.file.sha256,
path: input.file.path,
range: input.range,
operation: input.operation,
coverage: input.coverage,
...(input.confidence === undefined
? {}
: { confidence: input.confidence }),
...(input.limitations === undefined
? {}
: { limitations: input.limitations }),
...(input.loaderAuthority === "candidate"
? { confidence: "low" as const }
: input.confidence === undefined
? {}
: { confidence: input.confidence }),
...(input.loaderAuthority === "candidate"
? {
limitations: [
...(input.limitations ?? []),
ELECTRON_CANDIDATE_LIMITATION,
],
}
: input.limitations === undefined
? {}
: { limitations: input.limitations }),
}),
});
};