This occurs on many systems and I expect someone has a solution for it.
The PATH environment variable is a major part of security issues. For sanity's sake, the path portion of the .zshrc
looks like:
# Set Path
PATH_RUBY="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3..0/bin"
PATH_TREESITTER="$HOME/p/na/ts/tree_sitter_na/node_modules/.bin"
PATH_CONDA="/usr/local/anaconda3/bin"
PATH_CARGO=".cargo/bin"
PATH_TEX="/usr/texbin:/opt/X11/bin"
PATH_HOME="$HOME/bin:$HOME"
PATH_OSX="/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library
/Apple/usr/bin"
export PATH="$PATH_RUBY:$PATH_CONDA:$PATH_TREESITTER:$PATH_CARGO:$PATH_TEX:$PATH_HOME:$PATH_OSX"
While I can check the path munging to be sure that no full directory is repeated in the path, is there a function anyone has written to list of conflicts? I am trying to guard against some unchecked installation of a tool like TreeSitter
having its own ssh
command, which would execute instead of the later /usr/bin/ssh
. This tool would both add to security and also untangle badly done installations.
That is, I want a tool like:
$ checkpath
.../p/na/tree_sitter_na/node_modules/.bin/ssh occudes /usr/bin/ssh
$