CodeKit icon indicating copy to clipboard operation
CodeKit copied to clipboard

chmod doesn't work in the codekit's script context

Open gpapin opened this issue 8 years ago • 7 comments

Quick, short summary: command chmod has no effects on a mounted drive. it makes development very difficult as the web-server don't have permission to read generated files.

Expected results: -rw-r--r-- 1 gpapin www-data 0 févr. 17 16:04 test Actual results: -rwx------ 1 gpapin www-data 0 févr. 17 16:04 test Exact steps to reproduce: Add this step to the list of scripts

touch build/test
chmod 644 build/test

gpapin avatar Feb 17 '17 16:02 gpapin

Are you adding this as a build step or a Hook?

bdkjones avatar Feb 17 '17 18:02 bdkjones

Build step

On 17 Feb 2017 18:58, "Bryan Jones" [email protected] wrote:

Are you adding this as a build step or a Hook?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bdkjones/CodeKit/issues/321#issuecomment-280736042, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7B94VZpOB69P4QOfQfH8YUr7qSJjBOks5rde2kgaJpZM4MEc1Q .

gpapin avatar Feb 17 '17 20:02 gpapin

Does it work from the command line without elevated privileges?

bdkjones avatar Mar 03 '17 00:03 bdkjones

Hi Bryan, I've just changed my mac and I need to move everything over so I will get back to you in a few days if that's ok.

On 3 March 2017 at 00:13, Bryan Jones [email protected] wrote:

Does it work from the command line without elevated privileges?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bdkjones/CodeKit/issues/321#issuecomment-283824780, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7B95AZMEOQEBu5-A4Qg-zn7CDsdriqks5rh1ssgaJpZM4MEc1Q .

gpapin avatar Mar 03 '17 18:03 gpapin

Yea, I'm gonna guess the reason this doesn't work is that chmod needs elevated privileges. sudo, basically.

It would be an AWFUL idea on the scale of the Titanic's navigational plan to allow CodeKit to execute scripts with superuser privileges. That would basically turn the app into one giant attack vector—modify the script in a codekit3.config file, distribute that project, someone adds it, quickly clicks "ok" on the security warning I display, and then builds the project. All of a sudden, a password prompt appears, they type in their password without thinking and boom: compromised Mac.

Unlike the Terminal, where you SEE the command you're about to run with sudo, in the app, those scripts are hidden—you have to go pull them up and look at them, which many people won't do. They'll just blithely assume everything's fine.

bdkjones avatar Mar 04 '17 08:03 bdkjones

I don't see why codekit would need the root privilege to chmod some files belonging to my user (same user that is running codekit...), so yeah it works using the terminal.

My problem is simple really, I have a website running on a VM. This VM drive is mounted on the host and codekit watch for the frontend folder and compile everything to a single app.css and app.js. Now those 2 files are only readable by my user and I can't change permission to allow apache to read the file.

Those permission get overridden each time codekit compile - making my work very hard as I have to shell in and type few commands every single time I save a file or trigger a compilation...

gpapin avatar Mar 05 '17 17:03 gpapin

It may be the cross-volume mount point. Can you test that by adding a project on your local disk (not the VM) and then try chmod on a file in that project? Does that work?

Sent from my iPhone

On Mar 5, 2017, at 09:36, gpapin [email protected] wrote:

I don't see why codekit would need the root privilege to chmod some files belonging to my user (same user that is running codekit...), so yeah it works using the terminal.

My problem is simple really, I have a website running on a VM. This VM drive is mounted on the host and codekit watch for the frontend folder and compile everything to a single app.css and app.js. Now those 2 files are only readable by my user and I can't change permission to allow apache to read the file.

Those permission get overridden each time codekit compile - making my work very hard as I have to shell in and type few commands every single time I save a file or trigger a compilation...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

bdkjones avatar Mar 05 '17 20:03 bdkjones