We are already pulling out file paths in the bash command to reject the command if it has paths that are not allowed in it.
It would be good to have more sophisticated parsing to prevent things like
git -A
and many more.
A probably safer alternative is to submit the command to an agent who decides whether it is safe?