Skip to content

Commit ea2542c

Browse files
committed
BUG#27636947 - X PLUGINS AUTHENTICATION SEQUENCE MARKS ALL ERROR MESSAGES AS FATAL
Description =========== X Plugin limits the number of authentication tries to three. Errors returned in all authentication attempts are marked with 'severity' FATAL. This severity level is reserved for the last authentication failure after which server is going to disconnect the client. Fix === X Plugin is going to mark fatal severity to the authentication error which is going to be followed by disconnect: Client->Server: Mysqlx.Session.AuthenticateStart("SHA256_MEMORY") Client<-Server: Mysqlx.Error(severity:ERROR) Client->Server: Mysqlx.Session.AuthenticateStart("PLAIN") Client<-Server: Mysqlx.Error(severity:ERROR) Client->Server: Mysqlx.Session.AuthenticateStart("MYSQL41") Client<-Server: Mysqlx.Error(severity:FATAL) Client<-Server: disconnect RB: 19091 Reviewed-by: Tomasz Stepniak <[email protected]> Reviewed-by: Grzegorz Szwarc <[email protected]>
1 parent cdc60c8 commit ea2542c

File tree

10 files changed

+517
-22
lines changed

10 files changed

+517
-22
lines changed
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
call mtr.add_suppression("Maximum number of authentication attempts reached");
2+
3+
4+
#
5+
## Execute three "PLAIN" authentications
6+
## checking severity of returned errors (last one must be FATAL)
7+
#
8+
connecting...
9+
active session is now 'seq'
10+
Mysqlx.Ok {
11+
}
12+
13+
14+
# First authentication attempt
15+
send Mysqlx.Session.AuthenticateStart {
16+
mech_name: "PLAIN"
17+
auth_data: "test\000not_existing_user\000invalid_password"
18+
}
19+
20+
Mysqlx.Error(severity) = ERROR
21+
22+
# Second authentication attempt
23+
send Mysqlx.Session.AuthenticateStart {
24+
mech_name: "PLAIN"
25+
auth_data: "test\000not_existing_user\000invalid_password"
26+
}
27+
28+
Mysqlx.Error(severity) = ERROR
29+
30+
# Third authentication attempt (last one)
31+
send Mysqlx.Session.AuthenticateStart {
32+
mech_name: "PLAIN"
33+
auth_data: "test\000not_existing_user\000invalid_password"
34+
}
35+
36+
Mysqlx.Error(severity) = FATAL
37+
closing session seq
38+
switched to session default
39+
Mysqlx.Ok {
40+
msg: "bye!"
41+
}
42+
ok
43+
44+
45+
#
46+
## Execute three "SHA256_MEMORY" authentications
47+
## checking severity of returned errors (last one must be FATAL)
48+
#
49+
connecting...
50+
active session is now 'seq'
51+
Mysqlx.Ok {
52+
}
53+
54+
55+
# First authentication attempt
56+
send Mysqlx.Session.AuthenticateStart {
57+
mech_name: "SHA256_MEMORY"
58+
}
59+
60+
Mysqlx.Session.AuthenticateContinue {...}
61+
send Mysqlx.Session.AuthenticateContinue {
62+
auth_data: "test\000not_existing_user\000invalid_scramble"
63+
}
64+
65+
Mysqlx.Error(severity) = ERROR
66+
67+
# Second authentication attempt
68+
send Mysqlx.Session.AuthenticateStart {
69+
mech_name: "SHA256_MEMORY"
70+
}
71+
72+
Mysqlx.Session.AuthenticateContinue {...}
73+
send Mysqlx.Session.AuthenticateContinue {
74+
auth_data: "test\000not_existing_user\000invalid_scramble"
75+
}
76+
77+
Mysqlx.Error(severity) = ERROR
78+
79+
# Third authentication attempt (last one)
80+
send Mysqlx.Session.AuthenticateStart {
81+
mech_name: "SHA256_MEMORY"
82+
}
83+
84+
Mysqlx.Session.AuthenticateContinue {...}
85+
send Mysqlx.Session.AuthenticateContinue {
86+
auth_data: "test\000not_existing_user\000invalid_scramble"
87+
}
88+
89+
Mysqlx.Error(severity) = FATAL
90+
closing session seq
91+
switched to session default
92+
Mysqlx.Ok {
93+
msg: "bye!"
94+
}
95+
ok
96+
97+
98+
#
99+
## Execute three mixed authentications
100+
## checking severity of returned errors (last one must be FATAL)
101+
#
102+
connecting...
103+
active session is now 'seq'
104+
Mysqlx.Ok {
105+
}
106+
107+
108+
# First authentication attempt
109+
send Mysqlx.Session.AuthenticateStart {
110+
mech_name: "MYSQL41"
111+
}
112+
113+
Mysqlx.Session.AuthenticateContinue {...}
114+
send Mysqlx.Session.AuthenticateContinue {
115+
auth_data: "test\000not_existing_user\000invalid_scramble"
116+
}
117+
118+
Mysqlx.Error(severity) = ERROR
119+
120+
# Second authentication attempt
121+
send Mysqlx.Session.AuthenticateStart {
122+
mech_name: "SHA256_MEMORY"
123+
}
124+
125+
Mysqlx.Session.AuthenticateContinue {...}
126+
send Mysqlx.Session.AuthenticateContinue {
127+
auth_data: "test\000not_existing_user\000invalid_scramble"
128+
}
129+
130+
Mysqlx.Error(severity) = ERROR
131+
132+
# Third authentication attempt (last one)
133+
send Mysqlx.Session.AuthenticateStart {
134+
mech_name: "MYSQL41"
135+
}
136+
137+
Mysqlx.Session.AuthenticateContinue {...}
138+
send Mysqlx.Session.AuthenticateContinue {
139+
auth_data: "test\000not_existing_user\000invalid_scramble"
140+
}
141+
142+
Mysqlx.Error(severity) = FATAL
143+
closing session seq
144+
switched to session default
145+
Mysqlx.Ok {
146+
msg: "bye!"
147+
}
148+
ok
149+
150+
151+
#
152+
## Execute "SHA256_MEMORY", "MYSQL41", "PLAIN"
153+
## checking severity of returned errors (last one must be FATAL)
154+
#
155+
connecting...
156+
active session is now 'seq'
157+
Mysqlx.Ok {
158+
}
159+
160+
161+
# First authentication attempt
162+
send Mysqlx.Session.AuthenticateStart {
163+
mech_name: "SHA256_MEMORY"
164+
}
165+
166+
Mysqlx.Session.AuthenticateContinue {...}
167+
send Mysqlx.Session.AuthenticateContinue {
168+
auth_data: "test\000not_existing_user\000invalid_scramble"
169+
}
170+
171+
Mysqlx.Error(severity) = ERROR
172+
173+
# Second authentication attempt
174+
send Mysqlx.Session.AuthenticateStart {
175+
mech_name: "MYSQL41"
176+
}
177+
178+
Mysqlx.Session.AuthenticateContinue {...}
179+
send Mysqlx.Session.AuthenticateContinue {
180+
auth_data: "test\000not_existing_user\000invalid_scramble"
181+
}
182+
183+
Mysqlx.Error(severity) = ERROR
184+
185+
# Third authentication attempt (last one)
186+
send Mysqlx.Session.AuthenticateStart {
187+
mech_name: "PLAIN"
188+
auth_data: "test\000not_existing_user\000invalid_password"
189+
}
190+
191+
Mysqlx.Error(severity) = FATAL
192+
closing session seq
193+
switched to session default
194+
Mysqlx.Ok {
195+
msg: "bye!"
196+
}
197+
ok
198+
199+
200+
#
201+
## Verify that AuthenticateContinue message instead AuthStart
202+
## will trigger FATAL error and disconnection
203+
#
204+
send Mysqlx.Session.AuthenticateContinue {
205+
auth_data: "not meaningful field payload"
206+
}
207+
208+
Mysqlx.Error(severity) = FATAL
209+
ok
210+
211+
212+
#
213+
## Verify that StmtExecute message instead AuthStart
214+
## will trigger FATAL error and disconnection
215+
#
216+
send Mysqlx.Sql.StmtExecute {
217+
stmt: "not meaningful field payload"
218+
}
219+
220+
Mysqlx.Error(severity) = FATAL
221+
ok

mysql-test/suite/x/r/mysqlxtest_help.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The following commands may appear in the input script:
113113
and set the variable <varname>
114114
-->recverror <errno>
115115
Read a message and ensure that it's an error of the expected type
116-
-->recvtype <msgtype> [be-quiet]
116+
-->recvtype <msgtype> (<msg_fied>|be-quiet|<msg_fied> be-quiet|<msg_fied> <expected_field_value>|)
117117
Read one message and print it, checking that its type is the specified one
118118
-->recvok
119119
Expect to receive 'Mysqlx.Ok' message. Works with 'expecterror' command.

0 commit comments

Comments
 (0)