mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +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
@@ -3,15 +3,16 @@ import { javascriptSourceRangeKey } from "../../domain/javascript/javascriptSour
|
||||
import type { ElectronNativeAddonBindingFinding } from "../../domain/javascript/electronStaticAnalysisTypes.js";
|
||||
import type { JavaScriptArtifactFile } from "../../domain/javascript/javascriptArtifactFiles.js";
|
||||
import {
|
||||
artifactLocalIdentity,
|
||||
javascriptAnalysisCoverage,
|
||||
type JavaScriptArtifactGraphContext,
|
||||
type JavaScriptArtifactGraphCoverage,
|
||||
} from "./JavaScriptArtifactGraphContext.js";
|
||||
import { astObservationEvidence } from "./JavaScriptArtifactGraphEvidence.js";
|
||||
import { compositeKey } from "../../domain/unicodeCodePointOrder.js";
|
||||
import { javascriptDisplayText } from "../../domain/javascript/javascriptAstValues.js";
|
||||
import {
|
||||
addElectronInferenceEdge,
|
||||
electronFindingEvidence,
|
||||
electronFindingSourceNode,
|
||||
electronObservationIdentity,
|
||||
} from "./ElectronBoundaryGraphContext.js";
|
||||
@@ -45,15 +46,18 @@ const addNativeBinding = (input: NativeBindingInput): void => {
|
||||
value.module_runtime,
|
||||
);
|
||||
if (source === undefined) return;
|
||||
const resolved = resolveArtifactPathByContext({
|
||||
declaredPath: value.specifier,
|
||||
sourcePath: file.path,
|
||||
context: "module-specifier",
|
||||
files: context.filesByPath,
|
||||
jsonDocuments: context.analysis.jsonDocuments,
|
||||
directoryPaths: context.directoryPaths,
|
||||
moduleKind: value.module_kind,
|
||||
}).resolved_path;
|
||||
const resolved =
|
||||
value.loader_authority === "candidate"
|
||||
? null
|
||||
: resolveArtifactPathByContext({
|
||||
declaredPath: value.specifier,
|
||||
sourcePath: file.path,
|
||||
context: "module-specifier",
|
||||
files: context.filesByPath,
|
||||
jsonDocuments: context.analysis.jsonDocuments,
|
||||
directoryPaths: context.directoryPaths,
|
||||
moduleKind: value.module_kind,
|
||||
}).resolved_path;
|
||||
// Extension probing can resolve `./addon.node` to `addon.node.js`; only a
|
||||
// native-addon artifact can expose the requested binding.
|
||||
const addon =
|
||||
@@ -61,21 +65,29 @@ const addNativeBinding = (input: NativeBindingInput): void => {
|
||||
context.filesByPath.get(resolved)?.kind !== "native-addon"
|
||||
? undefined
|
||||
: context.fileNodes.get(resolved);
|
||||
const bindingKey = compositeKey([
|
||||
file.path,
|
||||
value.specifier,
|
||||
value.binding_kind,
|
||||
value.members,
|
||||
value.namespace_access ?? null,
|
||||
value.dynamic_member_access ?? null,
|
||||
javascriptSourceRangeKey(value.location),
|
||||
]);
|
||||
const binding = context.accumulator.addNode({
|
||||
kind: "native-export",
|
||||
identity: electronObservationIdentity(
|
||||
context,
|
||||
"javascript-requested-native-export",
|
||||
compositeKey([
|
||||
file.path,
|
||||
value.specifier,
|
||||
value.binding_kind,
|
||||
value.members,
|
||||
value.namespace_access ?? null,
|
||||
value.dynamic_member_access ?? null,
|
||||
javascriptSourceRangeKey(value.location),
|
||||
]),
|
||||
),
|
||||
identity:
|
||||
value.loader_authority === "candidate"
|
||||
? artifactLocalIdentity(
|
||||
file.sha256,
|
||||
"javascript-requested-native-export",
|
||||
bindingKey,
|
||||
)
|
||||
: electronObservationIdentity(
|
||||
context,
|
||||
"javascript-requested-native-export",
|
||||
bindingKey,
|
||||
),
|
||||
observations: [
|
||||
{
|
||||
label:
|
||||
@@ -89,17 +101,23 @@ const addNativeBinding = (input: NativeBindingInput): void => {
|
||||
dynamic_member_access: value.dynamic_member_access ?? null,
|
||||
resolved_path: resolved,
|
||||
native_export_verification: "not-performed",
|
||||
...(value.loader_authority === "candidate"
|
||||
? { loader_authority: "candidate" }
|
||||
: {}),
|
||||
},
|
||||
evidence: astObservationEvidence({
|
||||
sha256: file.sha256,
|
||||
path: file.path,
|
||||
range: value.location,
|
||||
operation: "observe-native-addon-binding",
|
||||
coverage,
|
||||
limitations: [
|
||||
"JavaScript syntax identifies requested member names; it does not prove that the native binary exports or implements them.",
|
||||
],
|
||||
}),
|
||||
evidence: electronFindingEvidence(
|
||||
{
|
||||
sha256: file.sha256,
|
||||
path: file.path,
|
||||
range: value.location,
|
||||
operation: "observe-native-addon-binding",
|
||||
coverage,
|
||||
limitations: [
|
||||
"JavaScript syntax identifies requested member names; it does not prove that the native binary exports or implements them.",
|
||||
],
|
||||
},
|
||||
value.loader_authority,
|
||||
),
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -111,6 +129,7 @@ const addNativeBinding = (input: NativeBindingInput): void => {
|
||||
coverage,
|
||||
relation: value.binding_kind === "re-export" ? "exposes" : "imports",
|
||||
operation: "map-native-addon-binding",
|
||||
loaderAuthority: value.loader_authority,
|
||||
properties: {
|
||||
specifier: value.specifier,
|
||||
binding_kind: value.binding_kind,
|
||||
|
||||
Reference in new issue
Block a user