Added an allow-list for libraries. Need to fill it in on Linux.

This commit is contained in:
Casey Langen 2022-02-17 20:14:44 -08:00
parent cdabafd4f2
commit 92a6be3e78

View File

@ -7,6 +7,11 @@ const mac = process.platform === 'darwin';
const filetype = mac ? '.dylib' : '.so'; const filetype = mac ? '.dylib' : '.so';
/* these libraries will always have dynamic dependencies, so ignore */
const ignoredLibraries = mac ? new Set([]) : new Set([]);
/* we assume these dependencies will always be available on the user's
target machine. */
const validLibraries = mac const validLibraries = mac
? new Set([ ? new Set([
'/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit', '/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit',
@ -47,7 +52,9 @@ if (!path) {
const ls = async (leaf) => { const ls = async (leaf) => {
const output = await readdir(`${path}/${leaf}`); const output = await readdir(`${path}/${leaf}`);
const files = output.filter((fn) => fn.indexOf(filetype) !== -1); const files = output
.filter((fn) => fn.indexOf(filetype) !== -1)
.filter((fn) => !ignoredLibraries.has(fn));
return files; return files;
}; };