The exported $PATH will only be valid/scoped within the script itself and will not effect the outside environment. So with this set, I've tried the path manipulation again:
$ PATH= ./timemachine
2021-04-01 12:26:35 timemachine: [ERROR] <source> and <destination> are required. See -h for help.
So this looks like it is fixing the issue of overriding the path from outside.
Note: In the above export PATH example, I've not specified any sbin/ directories, as they're not required for this script. So overall that should be pretty save, as a user won't be able to write to those directories
Release v1.3
Ensure that
$PATH
variable is explicitly set, so that you can't overwrite it from outside.Without setting
The exported $PATH will only be valid/scoped within the script itself and will not effect the outside environment. So with this set, I've tried the path manipulation again:
So this looks like it is fixing the issue of overriding the path from outside.
Note: In the above
export PATH
example, I've not specified anysbin/
directories, as they're not required for this script. So overall that should be pretty save, as a user won't be able to write to those directories