mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix: spawn Apple /bin/chmod by absolute path when hardening credentials
The macOS credential hardener strips ACLs with `chmod -N`, spawning `chmod` by bare name. On machines where Nix home-manager or Homebrew coreutils sit ahead of /bin on PATH, that resolves to GNU chmod, which has no `-N` flag and exits non-zero. The hardener treated that as a failure and refused every save from the Provider Settings panel with "could not restrict the credential file to your account; nothing was saved". Spawn /bin/chmod by absolute path instead, matching how the Windows branch already resolves its native tools without consulting PATH, and add a regression test that pins the absolute path.
This commit is contained in:
1 parent
0d41b6be54
commit
2a47bdb8e7
2 files changed
+20
-1
No files matched your search
@@ -55,6 +55,21 @@ test('macOS ACL removal failure stops before chmod and fails closed', () => {
|
||||
assert.deepEqual(fileSystem.calls, [], 'mode bits must not disguise an ACL-removal failure');
|
||||
});
|
||||
|
||||
test('macOS ACL removal spawns Apple /bin/chmod by absolute path, not via PATH', () => {
|
||||
const spawned = [];
|
||||
hardenCredentialFile(FILE, {
|
||||
platform: 'darwin',
|
||||
fileSystem: fileSystemWithMode(0o100600),
|
||||
spawn(command, args) {
|
||||
spawned.push([command, args]);
|
||||
return { status: 0, signal: null };
|
||||
},
|
||||
});
|
||||
// A coreutils-first PATH (Nix home-manager, Homebrew) resolves bare `chmod`
|
||||
// to GNU chmod, which has no `-N` and would fail every save.
|
||||
assert.deepEqual(spawned, [['/bin/chmod', ['-N', FILE]]]);
|
||||
});
|
||||
|
||||
test('POSIX hardening verifies the resulting 0600 mode', () => {
|
||||
const goodFs = fileSystemWithMode(0o100600);
|
||||
assert.equal(hardenCredentialFile(FILE, {
|
||||
|
||||
Reference in new issue
Block a user