Skip to content

Commit 573350c

Browse files
Add tests to check that username can't be changed during su
Users authenticating with su (both to another user and to root) shouldn't be able to change the username already selected in the command.
1 parent 9a81206 commit 573350c

2 files changed

Lines changed: 73 additions & 0 deletions

File tree

e2e-tests/resources/broker.resource

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,39 @@ Log In With Remote User Through CLI: Local Password
106106
Match Text ${username}@ubuntu:~$ 120
107107

108108

109+
Try Changing Username In sudo su Log In
110+
Hid.Type String sudo su
111+
Hid.Keys Combo Return
112+
Try Navigating Back to User Selection
113+
Cancel Operation
114+
115+
116+
Try Changing Username In su Log In
117+
[Arguments] ${username}
118+
Hid.Type String su ${username}
119+
Hid.Keys Combo Return
120+
Try Navigating Back to User Selection
121+
Cancel Operation
122+
123+
Try Navigating Back to User Selection
124+
# First screen is the autoselected local password mode
125+
Match Text Enter your local password: 120
126+
Hid.Keys Combo Escape
127+
128+
# The previous screen should be the authentication mode selection
129+
Match Text Select your authentication method 120
130+
Hid.Keys Combo Escape
131+
132+
# The previous screen should be the broker selection
133+
Match Text Select your provider 120
134+
Hid.Keys Combo Escape
135+
136+
# The previous screen is the username prompt, but it shouldn't be possible to get there
137+
Match Text Select your provider 120
138+
Hid.Keys Combo Escape
139+
Match Text Select your provider 120
140+
141+
109142
# Uses sed to change the broker configuration.
110143
# It should match both commented and uncommented lines.
111144
# The full command looks like:

e2e-tests/tests/su_login.robot

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
*** Settings ***
2+
Resource resources/utils.resource
3+
Resource resources/authd.resource
4+
Resource resources/broker.resource
5+
6+
# Test Tags robot:exit-on-failure
7+
8+
Test Setup utils.Test Setup snapshot=%{BROKER}-installed
9+
Test Teardown utils.Test Teardown
10+
11+
12+
*** Variables ***
13+
${username} %{E2E_USER}
14+
${local_password} qwer1234
15+
16+
17+
*** Test Cases ***
18+
Test su login
19+
[Documentation] Test login functionality with su command for remote users.
20+
21+
# Log in with local user
22+
Log In
23+
24+
# Log in with remote user with device authentication
25+
Open Terminal
26+
Log In With Remote User Through CLI: QR Code ${username} ${local_password}
27+
# Check remote user is properly added to the system
28+
Check If User Was Added Properly ${username}
29+
Log Out From Terminal Session
30+
Close Focused Window
31+
32+
# Log in with remote user with local password
33+
Open Terminal In Sudo Mode
34+
Log In With Remote User Through CLI: Local Password ${username} ${local_password}
35+
36+
# Try to change username during su login, it should not be possible
37+
Try Changing Username In su Log In ${username}
38+
39+
# Try to change username during su login with sudo, it should not be possible
40+
Try Changing Username In sudo su Log In

0 commit comments

Comments
 (0)