Skip to content

Commit

Permalink
python: Harden more tools against "rogue" modules
Browse files Browse the repository at this point in the history
Python scripts present in the same directory as the tool
override regular modules.

Fixes:
      #cat > /usr/bin/signal.py <<EOF
      import sys
      print("BAD GUY!", file=sys.stderr)
      sys.exit(1)
      EOF
      #sandbox date
      BAD GUY!

Signed-off-by: Vit Mojzis <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
vmojzis authored and jwcart2 committed Dec 12, 2023
1 parent 2752043 commit 94389f2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dbus/selinux_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/python3 -EsI

import dbus
import dbus.service
Expand Down
2 changes: 1 addition & 1 deletion gui/polgengui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
#
# polgengui.py - GUI for SELinux Config tool in system-config-selinux
#
Expand Down
6 changes: 3 additions & 3 deletions gui/system-config-selinux.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
#
# system-config-selinux.py - GUI for SELinux Config tool in system-config-selinux
#
Expand Down Expand Up @@ -32,6 +32,8 @@
print("This is a graphical application and requires DISPLAY to be set.")
sys.exit(1)

sys.path.append('/usr/share/system-config-selinux')

from gi.repository import GObject
import statusPage
import booleansPage
Expand Down Expand Up @@ -66,8 +68,6 @@

version = "1.0"

sys.path.append('/usr/share/system-config-selinux')


##
## Pull in the Glade file
Expand Down
2 changes: 1 addition & 1 deletion sandbox/sandbox
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
# Authors: Dan Walsh <[email protected]>
# Authors: Thomas Liu <[email protected]>
# Authors: Josh Cogliati
Expand Down
2 changes: 1 addition & 1 deletion sandbox/start
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3 -Es
#!/usr/bin/python3 -EsI
try:
from subprocess import getstatusoutput
except ImportError:
Expand Down

0 comments on commit 94389f2

Please sign in to comment.