mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 01:41:21 +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
@@ -11,6 +11,8 @@ import {
|
||||
unwrapJavaScriptExpression,
|
||||
} from "./javascriptAstValues.js";
|
||||
import { createSemanticExpressionShapeResolver } from "./javascriptSemanticExpressionShapes.js";
|
||||
import { semanticRequireOriginCandidate } from "./javascriptSemanticRequireOrigin.js";
|
||||
import { javaScriptRuntimeContext } from "./javascriptSourceParser.js";
|
||||
import { createGlobalReferenceReader } from "./javascriptSemanticAmbientWrites.js";
|
||||
import { javascriptBootstrapAt } from "./javascriptBootstrap.js";
|
||||
import { ELECTRON_MODULE } from "./javascriptElectronMemberWrites.js";
|
||||
@@ -358,7 +360,13 @@ export class JavaScriptSymbolicBindings {
|
||||
) {
|
||||
return symbolicUnknown("overwritten Electron API member");
|
||||
}
|
||||
return { kind: "external", path };
|
||||
return {
|
||||
kind: "external",
|
||||
path,
|
||||
...(value.loaderAuthority === "candidate"
|
||||
? { loaderAuthority: "candidate" as const }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
if (value.kind === "record") {
|
||||
const property = value.values.get(key);
|
||||
@@ -765,13 +773,25 @@ export class JavaScriptSymbolicBindings {
|
||||
if (!binding)
|
||||
return !semanticResolutionBlocked(this.state, node, node.name) &&
|
||||
["require", "navigator", "String", "Boolean"].includes(node.name)
|
||||
? { kind: "external", path: [node.name] }
|
||||
? node.name === "require" &&
|
||||
javaScriptRuntimeContext(this.state.program) === "module"
|
||||
? symbolicUnknown("CommonJS require is unavailable in an ES module")
|
||||
: {
|
||||
kind: "external",
|
||||
path: [node.name],
|
||||
...(node.name === "require" &&
|
||||
javaScriptRuntimeContext(this.state.program) === "unknown"
|
||||
? { loaderAuthority: "candidate" as const }
|
||||
: {}),
|
||||
}
|
||||
: symbolicUnknown("unbound identifier");
|
||||
if (binding.definitions.some((d) => d.kind === "assignment"))
|
||||
return symbolicUnknown("reassigned binding");
|
||||
// Electron member identity is checked at the selected property. A write
|
||||
// to one method must not erase the module origin or unaffected siblings.
|
||||
const electronOrigin = this.#electronIdentity.exportPath(node);
|
||||
const electronOrigin =
|
||||
this.#electronIdentity.exportPath(node) ??
|
||||
this.#electronIdentity.candidateExportPath(node);
|
||||
if (electronOrigin === undefined && this.#mutated.has(binding.bindingId))
|
||||
return symbolicUnknown("dynamic member writes");
|
||||
for (let e: SymbolicEnvironment | undefined = env; e; e = e.parent) {
|
||||
@@ -1176,7 +1196,15 @@ export class JavaScriptSymbolicBindings {
|
||||
const spec = args[0];
|
||||
result =
|
||||
spec?.kind === "literal" && typeof spec.value === "string"
|
||||
? { kind: "external", path: [spec.value] }
|
||||
? {
|
||||
kind: "external",
|
||||
path: [spec.value],
|
||||
...(semanticRequireOriginCandidate(node, this.state)?.origin
|
||||
.loaderAuthority === "candidate" ||
|
||||
value.loaderAuthority === "candidate"
|
||||
? { loaderAuthority: "candidate" as const }
|
||||
: {}),
|
||||
}
|
||||
: symbolicUnknown("dynamic require");
|
||||
} else if (
|
||||
value.kind !== "function" ||
|
||||
|
||||
Reference in new issue
Block a user