fix(audit): keep companion coverage unresolved for a generic .map link

This commit is contained in:
Matt Van Horn committed 2026-11-03 10:27:47 -08:00
1 parent 412f22ea78
commit 0cb0d43e79
2 files changed
+28

No files matched your search

@@ -1057,6 +1057,31 @@ describe("ReleaseExposureReader mixed maps and sibling paths", () => {
);
});
describe("ReleaseExposureReader generic map links", () => {
it.skipIf(process.platform === "win32")(
"keeps debug companion coverage unresolved for a generic .map link",
async () => {
const root = await createTestTempDirectory("rea-release-map-link-");
await writeFile(join(root, "payload"), "not a map\n");
await symlink("payload", join(root, "symbols.map"));
const scanned = await inspect(root);
expect(scanned.debug_companions.skipped).toBe(1);
expect(scanned.source_maps.skipped).toBe(1);
},
);
it.skipIf(process.platform === "win32")(
"leaves debug companions alone for a JavaScript map link",
async () => {
const root = await createTestTempDirectory("rea-release-map-link-");
await writeFile(join(root, "payload"), "{}");
await symlink("payload", join(root, "app.js.map"));
const scanned = await inspect(root);
expect(scanned.debug_companions.skipped).toBe(0);
},
);
});
describe("ReleaseExposureReader acquisition and sibling review regressions", () => {
it.each(["external section", "decoder limit", "malformed JSON"])(
"keeps a sibling map with an unsupported %s unresolved",
+3
View File
@@ -2685,6 +2685,9 @@ const noteUnfollowedMapLink = (
state.examinedMaps.add(key);
state.examinedScripts.add(key);
state.skippedMaps += 1;
// A generic `.map` link may name a linker map, as an unread map may.
if (isSourceMap(logical, "file") && !isJavaScriptSourceMapName(logical))
state.skippedCompanions += 1;
};
const noteUnlistedEntry = (state: ScanState, entry: ArtifactEntry): void => {