From 0fc9789f4313f5100f10417aebc91ca0e71a09ee Mon Sep 17 00:00:00 2001 From: snarlynarwhal Date: Thu, 24 May 2018 19:34:30 -0400 Subject: [PATCH 1/2] Fixed folder permissions check so it considers setuid, setgid, and sticky bits Closes #724 - Prefixed the folder permissions check help command chmod paramter with "00" to clear the setuid, setgid, and sticky bits - Updated the unit tests for folder permissions to coincide with aforementioned change --- lib/commands/doctor/checks/check-permissions.js | 2 +- test/unit/commands/doctor/checks/folder-permissions-spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/commands/doctor/checks/check-permissions.js b/lib/commands/doctor/checks/check-permissions.js index 0ce28574a..ae9d7bf44 100644 --- a/lib/commands/doctor/checks/check-permissions.js +++ b/lib/commands/doctor/checks/check-permissions.js @@ -18,7 +18,7 @@ module.exports = function checkPermissions(type, task) { }, folder: { command: 'find ./ -type d ! -perm 775 ! -perm 755', - help: `Run ${chalk.green('sudo find ./ -type d -exec chmod 775 {} \\;')} and try again.` + help: `Run ${chalk.green('sudo find ./ -type d -exec chmod 00775 {} \\;')} and try again.` }, files: { command: 'find ./ -type f ! -path "./versions/*" ! -perm 664 ! -perm 644', diff --git a/test/unit/commands/doctor/checks/folder-permissions-spec.js b/test/unit/commands/doctor/checks/folder-permissions-spec.js index 1fafd44eb..c752d4b14 100644 --- a/test/unit/commands/doctor/checks/folder-permissions-spec.js +++ b/test/unit/commands/doctor/checks/folder-permissions-spec.js @@ -41,7 +41,7 @@ describe('Unit: Doctor Checks > Checking folder permissions', function () { expect(error).to.be.an.instanceof(errors.SystemError); expect(error.message).to.match(/Your installation folder contains some directories or files with incorrect permissions:/); expect(error.message).to.match(/- \.\/system\/apps/); - expect(error.message).to.match(/sudo find \.\/ -type d -exec chmod 775 \{\} \\;/); + expect(error.message).to.match(/sudo find \.\/ -type d -exec chmod 00775 \{\} \\;/); expect(execaStub.called).to.be.true; }); }); @@ -55,7 +55,7 @@ describe('Unit: Doctor Checks > Checking folder permissions', function () { expect(error).to.be.an.instanceof(errors.SystemError); expect(error.message).to.match(/Your installation folder contains a directory or file with incorrect permissions:/); expect(error.message).to.match(/- .\/content\/images\/test.jpg/); - expect(error.message).to.match(/sudo find \.\/ -type d -exec chmod 775 \{\} \\;/); + expect(error.message).to.match(/sudo find \.\/ -type d -exec chmod 00775 \{\} \\;/); expect(execaStub.called).to.be.true; }); }); From c24823bbf329e85095323e1ffc1fc0dd3eedc163 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Mon, 28 May 2018 07:45:48 -0400 Subject: [PATCH 2/2] add code comment --- lib/commands/doctor/checks/check-permissions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/commands/doctor/checks/check-permissions.js b/lib/commands/doctor/checks/check-permissions.js index ae9d7bf44..29d025ae9 100644 --- a/lib/commands/doctor/checks/check-permissions.js +++ b/lib/commands/doctor/checks/check-permissions.js @@ -18,6 +18,7 @@ module.exports = function checkPermissions(type, task) { }, folder: { command: 'find ./ -type d ! -perm 775 ! -perm 755', + // chmod mode from http://man7.org/linux/man-pages/man1/chmod.1.html#SETUID_AND_SETGID_BITS help: `Run ${chalk.green('sudo find ./ -type d -exec chmod 00775 {} \\;')} and try again.` }, files: {