Skip to content

Commit

Permalink
Resign node binary on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed May 10, 2024
1 parent 5a2d00b commit cc123e6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gui/standalone-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ function extract() {
function createSealessNode() {
const nodeBin = path.join(tmpDir, 'node');

fs.copyFileSync(process.argv[0], nodeBin);

// Find and disable SEA fuse in node binary
const fuseString = 'NODE_SEA_FUSE_' + 'fce680ab2cc467b6e072b8b5df1996b2:';

let buf = fs.readFileSync(process.argv[0]);
if (process.platform === 'darwin') {
child_process.spawnSync('/usr/bin/codesign', ['--remove-signature', nodeBin]);
}

let buf = fs.readFileSync(nodeBin);

Check failure on line 49 in gui/standalone-tests.ts

View workflow job for this annotation

GitHub Actions / check-frontend (ubuntu-latest)

'buf' is never reassigned. Use 'const' instead
const fuseIndex = buf.indexOf(fuseString);

if (fuseIndex !== -1) {
Expand All @@ -53,6 +59,10 @@ function createSealessNode() {
}
}

if (process.platform === 'darwin') {
child_process.spawnSync('/usr/bin/codesign', ['--sign', '-', nodeBin]);
}

return nodeBin;
}

Expand Down

0 comments on commit cc123e6

Please sign in to comment.