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

@@ -5,7 +5,11 @@ import { createHash } from "node:crypto";
import type { ArtifactInventorySnapshot } from "../../domain/artifactInventorySnapshot.js";
import type { JavaScriptArtifactFile } from "../../domain/javascript/javascriptArtifactFiles.js";
import { analyzeJavaScriptStaticSource } from "../../domain/javascript/javascriptStaticAnalysis.js";
import {
analyzeJavaScriptStaticSource,
analyzeParsedJavaScriptStaticSource,
} from "../../domain/javascript/javascriptStaticAnalysis.js";
import { parseJavaScriptSource } from "../../domain/javascript/javascriptSourceParser.js";
import type {
AnalyzedJavaScriptArtifactFile,
JavaScriptArtifactAnalysis,
@@ -25,6 +29,13 @@ const SHA256 = "a".repeat(64);
const REASON =
"main.js: Resource constraint during analyze_javascript_application: Owned JavaScript worker exhausted its heap while analyzing main.js during static";
/** Preserve the explicit artifact filename when analyzing owned test fixtures. */
const analyzeOwnedSource = (source: string, path: string) => {
const parsed = parseJavaScriptSource(source, path);
if (parsed === null) throw new Error(`Unable to parse ${path}`);
return analyzeParsedJavaScriptStaticSource(source, parsed);
};
const skippedFile = (): JavaScriptArtifactFile => ({
path: "main.js",
container_sha256: SHA256,
@@ -245,15 +256,17 @@ it.each([false, true])(
const analysis = analysisFor([
{
file: setter,
javascript: analyzeJavaScriptStaticSource(
javascript: analyzeOwnedSource(
'const { app } = require("electron"); app.setAppPath("/changed");',
setter.path,
),
semantic: null,
},
{
file: window,
javascript: analyzeJavaScriptStaticSource(
javascript: analyzeOwnedSource(
'const { BrowserWindow } = require("electron"); new BrowserWindow().loadFile("index.html");',
window.path,
),
semantic: null,
},
@@ -361,20 +374,21 @@ it.each([
const entries: AnalyzedJavaScriptArtifactFile[] = [
{
file: main,
javascript: analyzeJavaScriptStaticSource(statement + window),
javascript: analyzeOwnedSource(statement + window, main.path),
semantic: null,
},
{
file: other,
javascript: analyzeJavaScriptStaticSource(window),
javascript: analyzeOwnedSource(window, other.path),
semantic: null,
},
...(gap === "transitive-unselected"
? [
{
file: makeFile("a/middle.cjs"),
javascript: analyzeJavaScriptStaticSource(
javascript: analyzeOwnedSource(
'require("./change.cjs");',
"a/middle.cjs",
),
semantic: null,
},