Skip to content

Commit

Permalink
test: sudo stores an uid instead of a username since 1.9.15
Browse files Browse the repository at this point in the history
This fixed a security issue where a username could contain a path
separator so now it uses an uid instead.
  • Loading branch information
jelly committed Nov 13, 2023
1 parent 9c73749 commit e36f0e2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/verify/check-superuser
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ class TestSuperuser(testlib.MachineCase):
self.restore_file("/var/lib/sudo/lectured/admin")
m.execute("rm -rf /var/{db,lib}/sudo/lectured/admin")

# Sudo since 1.9.15 uses a UID not a username https://www.sudo.ws/releases/stable/#1.9.15
uid = m.execute("id -u admin").strip()
self.restore_file(f"/var/db/sudo/lectured/{uid}")
self.restore_file(f"/var/lib/sudo/lectured/{uid}")
m.execute(f"rm -rf /var/{{db,lib}}/sudo/lectured/{uid}")

# Get the privileges back, this time in the mobile layout
b.set_layout("mobile")
b.open_superuser_dialog()
Expand Down

0 comments on commit e36f0e2

Please sign in to comment.