Commit 1d2aac1
authored
fix(nox): improve the PATH manipulation (#920)
When `type -p "$1"` fails or does not output anything because the file
is hidden by an alias or a function, the current treatment results in
`PATH=:$PATH`. The empty path in `PATH` results in possible executions
of an executable file in the current directory,
`./register-python-argcomplete` or `./register-python-argcomplete3`,
which can be a vulnerability. An attacker might put arbitrary
commands in the files named `register-python-argcomplete`.
For the case that the command is hidden by an alias or by a shell
function, we can use `type -P "$1"` instead of `type -p "$1"`. For
the case, that the user attempts to run a completion for the command
that is not installed in the system, we can test whether the resulting
path is non-empty.
#917 (comment)1 parent 23c8e08 commit 1d2aac1
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments