mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 17:59:08 +00:00
fix(audit): count a .map link beside a selected file as a skipped companion
The sibling scan skipped any .map entry that was not a regular file, so a symlink such as symbols.map -> payload beside a selected executable left debug companion coverage at not observed. The reader never follows links, so the linker map such a link may name is unread, not absent. Count a generic .map sibling link as a skipped companion without following it, as noteUnfollowedMapLink already does inside a selected directory.
This commit is contained in:
2 files changed
+21
-1
No files matched your search
@@ -1071,6 +1071,20 @@ describe("ReleaseExposureReader generic map links", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"keeps debug companion coverage unresolved for a .map link beside a selected file",
|
||||
async () => {
|
||||
const root = await createTestTempDirectory("rea-release-sibling-link-");
|
||||
await writeFile(join(root, "app"), "plain file");
|
||||
await writeFile(join(root, "payload"), "not a map\n");
|
||||
await symlink("payload", join(root, "symbols.map"));
|
||||
await symlink("payload", join(root, "app.js.map"));
|
||||
const scanned = await inspect(join(root, "app"));
|
||||
expect(scanned.debug_companions).toEqual({ paths: [], skipped: 1 });
|
||||
expect(debugCompanionsStatus(scanned)).toBe("unknown");
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"leaves debug companions alone for a JavaScript map link",
|
||||
async () => {
|
||||
|
||||
@@ -2561,8 +2561,14 @@ const scanSiblings = async (
|
||||
state.companionPaths.add(sibling);
|
||||
continue;
|
||||
}
|
||||
if (!entry.name.toLowerCase().endsWith(".map") || !entry.isFile()) continue;
|
||||
if (!entry.name.toLowerCase().endsWith(".map")) continue;
|
||||
if (isJavaScriptSourceMapName(entry.name)) continue;
|
||||
// A link is not followed, so a linker map it names stays unread, not absent.
|
||||
if (entry.isSymbolicLink()) {
|
||||
state.skippedCompanions += 1;
|
||||
continue;
|
||||
}
|
||||
if (!entry.isFile()) continue;
|
||||
await classifySiblingMap(sibling, state, input);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user