Skip to content

Commit 4bfe315

Browse files
authored
chore(test): verify history file permissions MONGOSH-659 (#748)
1 parent d688652 commit 4bfe315

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/cli-repl/test/e2e.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,18 @@ describe('e2e', function() {
709709

710710
expect(await fs.readFile(historyPath, 'utf8')).to.match(/^a = 42$/m);
711711
});
712+
713+
it('is only user-writable (on POSIX)', async function() {
714+
if (process.platform === 'win32') {
715+
return this.skip(); // No sensible fs permissions on Windows
716+
}
717+
718+
await shell.executeLine('a = 42');
719+
shell.writeInput('.exit\n');
720+
await shell.waitForExit();
721+
722+
expect((await fs.stat(historyPath)).mode & 0o077).to.equal(0);
723+
});
712724
});
713725

714726
describe('mongoshrc', () => {

0 commit comments

Comments
 (0)