You know this
which makes environment injection impossible. I was wandering if this functionality can be obtained from bash script directly, 'from inside'?
At least part of it can, that is for sure. Example:
#!/usr/bin/env php <?php //... // sanitizes $PATH putenv("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"); // unsets $LD_LIBRARY_PATH, as it should be in Ubuntu putenv('LD_LIBRARY_PATH'); //...
Can we do
env_reset in running script like
sudo does and how?
I'm not looking for the way to do it 'from outside' like
env -i commandbut from inside of script itself. My intention is to ensure security no matter who (what user) and how(under which circumstances, i.e. env variables) runs it.