privacy-scan: AppImage squashfs found at the end of the ELF runtime (the runtime contains the magic too); a generic home (/root) is not a term. tools test: 30s timeout (detectTools runs every version command)
This commit is contained in:
parent
03b938efa3
commit
e3711ec52f
3 changed files with 26 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ import { spawnSync } from 'node:child_process';
|
|||
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { collectTerms, kindOf, mask, parseTerms, scan, scanBuffer, type Term } from '../tools/privacy-scan';
|
||||
import { collectTerms, kindOf, mask, parseTerms, scan, scanBuffer, squashfsOffset, type Term } from '../tools/privacy-scan';
|
||||
|
||||
const T: Term[] = [{ text: 'Quillfeather', short: false }, { text: 'qz', short: true }];
|
||||
// home folders are put together at run time, so tools/scrub.ts (which forbids them in the repository) passes
|
||||
|
|
@ -64,4 +64,13 @@ describe('privacy scan', () => {
|
|||
expect(kindOf('storebound_0.1.0_x64-setup.exe', Buffer.from('MZ....Nullsoft Install System'))).toBe('nsis');
|
||||
expect(kindOf('storebound-desktop.exe', Buffer.from('MZ'))).toBe('file');
|
||||
});
|
||||
test('AppImage: the squashfs starts where the ELF runtime ends, not at an "hsqs" constant inside the runtime', () => {
|
||||
const img = Buffer.alloc(0x1000 + 16);
|
||||
img.write('\x7fELF', 0, 'latin1'); img[4] = 2; img[5] = 1;
|
||||
img.writeBigUInt64LE(0xc00n, 0x28); img.writeUInt16LE(64, 0x3a); img.writeUInt16LE(16, 0x3c); // 0xc00 + 64*16 = 0x1000
|
||||
img.write('hsqs', 0x800, 'latin1'); img.write('hsqs', 0x1000, 'latin1');
|
||||
expect(squashfsOffset(img)).toBe(0x1000);
|
||||
const plain = Buffer.alloc(0x900); plain.write('hsqs', 0x800, 'latin1');
|
||||
expect(squashfsOffset(plain)).toBe(0x800);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,5 +36,5 @@ describe('local tools (desktop Dependencies screen)', () => {
|
|||
expect(tools.map(t => t.id)).toEqual(expect.arrayContaining(['ffmpeg', 'ffprobe', 'chrome', 'adb', 'git']));
|
||||
for (const t of tools) if (t.id === 'xcode' || t.id === 'simctl' || t.id === 'adb') expect(t.install.kind).toBe('link');
|
||||
} finally { rmSync(dir, { recursive: true, force: true }); }
|
||||
});
|
||||
}, 30_000); // detectTools runs every tool's version command (xcrun, simctl, adb, ...): seconds on a busy Mac
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue