in reply to Re^2: What restrictions are there on code execution when running perl in syntax check mode?
in thread What restrictions are there on code execution when running perl in syntax check mode?

You make a good point, but I don't think the safety problem is reducible to "If I don't think its safe...". Just scan the web for all the people who innocently rooted themselves because they had a typo in an rm command and a foolish OS distro that didn't no-op rm / by default.
I don't understand what typos have to do with it. You can make a typo on the command line as well. Furthermore, such typos aren't detected by syntax checks anyway.

Also, with "if you think it's safe/not safe" means "would you run this code or not?". If you don't want to run it, for whatever reason, who cares it has syntax errors. If you've already decided that you want to run it, that doing a syntax check isn't more harmful.

Couldn't the perl syntax checker have been/be designed to monitor certain system calls and no-op them unless a flag was explicitly set to do otherwise?
Maybe. But fact it is, it doesn't. In fact, the syntax checker isn't anything special. What we call "the syntax checker" is the -c option. What -c does is to not run the program after it was compiled. There's no separate "check the syntax" part in perl. But you may tinker with the Safe module, and compile the code you worry about in the sandbox provided by the Safe module.

Note however, that for whatever action you want to prevent, I can design a piece of code that cannot be compiled, unless that action is allowed.

  • Comment on Re^3: What restrictions are there on code execution when running perl in syntax check mode?