I'm trying to understand more about this edit that was made to an answer of mine:
https://unix.stackexchange.com/revisions/510388/5
How does running cd "{}"
in the context of a find command introduce vulnerability to injection attacks?
For reference, the change made to cover the vulnerability was:
diff --git a/command b/command
index 26488d0..fed4c07 100644
--- a/command
+++ b/command
@@ -1 +1 @@
-find . -type d -exec sh -c 'cd {} && echo "Spawning a shell in $PWD..." && sh' \;
+find . -type d -exec sh -c 'cd "$1" && echo "Spawning a shell in $PWD..." && sh' sh {} \;