]> Kevux Git Server - fll/commitdiff
Security: Explicitly define IFS to prevent misuse. development
authorKevin Day <Kevin@kevux.org>
Fri, 6 Jun 2025 02:35:34 +0000 (21:35 -0500)
committerKevin Day <Kevin@kevux.org>
Fri, 6 Jun 2025 02:35:34 +0000 (21:35 -0500)
The scripts are written with certain expectations.
This expectation may not be properly met if the `IFS` value is changed.
This can potentially be used to create some sort of exploit.

Explicitly define IFS and then do so at a local variable scope to prevent affecting the callers IFS setting.`

16 files changed:
build/scripts/bootstrap-example.sh
build/scripts/bootstrap.sh
build/scripts/generate_codepoints_from_digits.sh
build/scripts/generate_ctags.sh
build/scripts/generate_unicode.sh
build/scripts/install.sh
build/scripts/package.sh
build/scripts/test.sh
level_3/fake/data/build/process_post.sh
level_3/fake/data/build/process_pre.sh
level_3/fake/data/projects/go/example_go/data/build/process_post.sh
level_3/fake/data/projects/go/example_go/data/build/process_pre.sh
level_3/fss_read/tests/runtime/script/generate.sh
level_3/fss_read/tests/runtime/script/verify.sh
level_3/iki_read/tests/runtime/script/generate.sh
level_3/iki_read/tests/runtime/script/verify.sh

index d7044493bc0d69c88ef719321111df06ec9bd81d..c049419a23cf3d421f646ba852999ae168ab5148 100644 (file)
@@ -42,6 +42,8 @@
 #
 
 main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
     emulate ksh
   fi
index aef0497c4058550590ab83f5b6f1ef87a0ea98f5..1e5562c6bdbda440c0eedda23c8e85142e4121ee 100644 (file)
@@ -13,6 +13,7 @@
 #
 
 bootstrap_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
 
   if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
     emulate ksh
@@ -3035,4 +3036,4 @@ bootstrap_cleanup() {
   unset bootstrap_cleanup
 }
 
-bootstrap_main $*
+bootstrap_main ${*}
index 1bc3410627ceb64e2761d9e2cd398d61effebebd..fe7d3a469ed1439a016acb6821f0408a2b422754 100644 (file)
@@ -9,6 +9,8 @@
 #
 
 main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local -i first="$1"
   local -i last="$2"
 
index a3d86b658547ae3228fff8ab77b7ab776a5ca55d..23467c93d85d0ec9b8bda0bac934041e87c589b5 100644 (file)
@@ -10,6 +10,7 @@
 #
 
 main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
 
   if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
     emulate ksh
@@ -290,4 +291,4 @@ generate_ctags_cleanup() {
   unset generate_ctags_cleanup
 }
 
-main $*
+main ${*}
index 9815ff130d6d76f2e4965f19efbf6d88db81d7b5..b339669eebb9ac0e68dbeb276cd6e828c367d463 100644 (file)
@@ -11,6 +11,8 @@
 #
 
 main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local file_input="codes.txt"
   local mode=$1
   local code=
index c8972d1ebc6c7a806426bc97ec09f215724c4eae..fb971b524f4dbb66913ed1d71cc6e0775e3c80ed 100644 (file)
@@ -14,6 +14,7 @@
 #
 
 install_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
 
   if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
     emulate ksh
@@ -877,4 +878,4 @@ install_cleanup() {
   unset install_cleanup
 }
 
-install_main $*
+install_main ${*}
index a87472d82b94b92e50b25ab9e25f995b52e4ab45..fe899883459b85339bd32d730b708c98975e23bc 100644 (file)
@@ -12,6 +12,7 @@
 #
 
 package_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
 
   if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
     emulate ksh
@@ -2438,4 +2439,4 @@ package_cleanup() {
   unset package_cleanup
 }
 
-package_main $*
+package_main ${*}
index e8359398309077458ab710ae1864a16ab899e042..51ddbb03b19cc1b47c12ad4bc385d6e26980b3a6 100644 (file)
@@ -14,6 +14,7 @@
 #
 
 test_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
   local shell_command=bash
 
   if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
@@ -1129,4 +1130,4 @@ test_cleanup() {
   unset test_cleanup
 }
 
-test_main $*
+test_main ${*}
index 500d1d0e0f3081e7179fdcbca864995f4d1cf0fa..c00efa9efc3e8c1e351cb2bb79b743cb14e30aa0 100755 (executable)
@@ -8,6 +8,8 @@
 # The dependencies of this script are: bash and sed.
 #
 process_post_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local grab_next=
   local do_color=dark
   local i=0
index a7500c0bb599c789f9849c374ff2dfde521de5f0..1f4c785aaded17cc1c05fc669e8ca78afb4fc0f2 100755 (executable)
@@ -8,6 +8,8 @@
 # The dependencies of this script are: bash and sed.
 #
 process_pre_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local grab_next=
   local do_color=dark
   local i=0
index 05a7907cf5a4a5927d09b1e964aae97a096908f6..a5fc4d84e061b5bd3edab3d492f8bd4d212c6cae 100755 (executable)
@@ -1,2 +1,8 @@
 #!/bin/bash
 
+main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
+}
+
+main ${*}
index 05a7907cf5a4a5927d09b1e964aae97a096908f6..a5fc4d84e061b5bd3edab3d492f8bd4d212c6cae 100755 (executable)
@@ -1,2 +1,8 @@
 #!/bin/bash
 
+main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
+}
+
+main ${*}
index 11c847950e5fb97d604b581cadc25bc15ec8077e..d3543bb592a5d90d91a8967a06bd43ea65b98517 100644 (file)
@@ -11,6 +11,8 @@
 #
 
 generate_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local file_source="${2}"
   local path_destination="${3}"
   local failure=0
index 64b9517df9ab61cf89aa06a3156fcd1ec6ade4c5..b6eb78c91a272a2f0bf06b4039af384ea74a87a3 100644 (file)
@@ -10,6 +10,8 @@
 #
 
 verify_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local path_build="${1}"
   local path_expect="${2}"
   local test_name="${3}"
index 7138fbe563d27d23fa1f033775f3eb68c4577aaf..40dcc5d818dfebb1f27b4d51ba9e51f7dc561f52 100644 (file)
@@ -11,6 +11,8 @@
 #
 
 generate_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local file_source="${2}"
   local path_destination="${3}"
   local failure=0
index 64b9517df9ab61cf89aa06a3156fcd1ec6ade4c5..b6eb78c91a272a2f0bf06b4039af384ea74a87a3 100644 (file)
@@ -10,6 +10,8 @@
 #
 
 verify_main() {
+  local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
+
   local path_build="${1}"
   local path_expect="${2}"
   local test_name="${3}"