Add strict PATH environment variable into init scripts 67/77767/2
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Fri, 1 Jul 2016 04:37:14 +0000 (07:37 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Fri, 1 Jul 2016 06:27:23 +0000 (09:27 +0300)
This change guarantee execution aux programs only from trusted paths.
Even most of programs has absolute path in scripts this change
will prevent security issues in further changes.

Change-Id: I108f5246c6af29eb8f3f4bff278b38941ad208f8
Signed-off-by: Dmitry Kovalenko <d.kovalenko@samsung.com>
scripts/gen_loader_header.sh
scripts/gen_preload_header.sh
scripts/gen_uihv_header.sh [changed mode: 0644->0755]
scripts/gen_wsp_data.sh
scripts/swap_start.sh
scripts/swap_stop.sh

index 007d8ab..2d88950 100755 (executable)
@@ -15,8 +15,10 @@ output=$1
 function print_header()
 {
     filename=$1
-    echo -e "#!/bin/bash\n"\
-            "#Loader\n" > $filename
+    echo "#!/bin/bash
+#Loader
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+" > $filename
 }
 
 function print_loader()
index 48b1b63..ce26470 100755 (executable)
@@ -10,8 +10,10 @@ output=$1
 function print_header()
 {
     filename=$1
-    echo -e "#!/bin/bash\n"\
-            "#Preload\n" > $filename
+    echo "#!/bin/bash
+#Preload
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+" > $filename
 }
 
 function print_probe_lib()
old mode 100644 (file)
new mode 100755 (executable)
index 3289f4a..e21b489
@@ -7,8 +7,10 @@ output=$1
 function print_header()
 {
     filename=$1
-    echo -e "#!/bin/bash\n"\
-            "#Preload\n" > $filename
+    echo "#!/bin/bash
+#Preload
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+" > $filename
 }
 
 function print_ui_viewer_lib()
index a8432f0..01fe413 100755 (executable)
@@ -163,7 +163,7 @@ function gen_script_out()
                #!/bin/bash
 
                #WSP initialze autogenerated script
-
+               PATH=/bin:/usr/bin:/sbin:/usr/sbin
                /bin/echo "$path_webapp" > $webapp_path
                /bin/echo "$path_libewebkit2" > $ewebkit_path
 
index 279b5b4..a6fbe4a 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
 #ERROR CODES
 ERR_CONTAINER_NOT_SUPPORTED=1
 ERR_NO=0
@@ -12,7 +14,6 @@ if [ "$1" != "" ];then
     exit $1
 fi
 
-PATH=$PATH:/usr/sbin/
 
 config_file="/etc/config/model-config.xml"
 if [ -e $config_file ]; then
index 90fe763..47d8549 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
 # swap disabling
 /bin/echo 0 > /sys/kernel/debug/swap/enable