Skip to content

Commit 5756106

Browse files
Andrzej Religadahlerlend
authored andcommitted
WL#15440 MySQL REST Service (MRS) - Umbrella WL
Bug#37616958 MRS user lookup is case insensitive, where some auth-app require case sensitivity Changed the bahavior, now the MRS auth user provided must match the one in the metadata case-sensitively. Change-Id: Ia32ba15a95553ceb5271c880a2100cb65a38d9b0
1 parent 99d9a9b commit 5756106

File tree

7 files changed

+44
-1
lines changed

7 files changed

+44
-1
lines changed

mysql-test/suite/router/include/test/authentication_mrs.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ exec $MRS_CLIENT_ARGS
215215
--echo
216216
--echo #
217217
--echo # III.1
218+
--echo Check no access for non existing user
218219
exec $MRS_CLIENT_ARGS
219220
-a $test_scram
220221
--path /svc1/authentication/login
@@ -223,6 +224,17 @@ exec $MRS_CLIENT_ARGS
223224
--expected-status Unauthorized
224225
--session-type $test_session_type;
225226

227+
--echo Check the username is case-sensitive
228+
exec $MRS_CLIENT_ARGS
229+
-a $test_scram
230+
--path /svc1/authentication/login
231+
-u Svc1_usr
232+
-p test
233+
$_test_auth_app
234+
--expected-status Unauthorized
235+
--session-type $test_session_type;
236+
237+
--echo Check no access with bad password
226238
exec $MRS_CLIENT_ARGS
227239
-a $test_scram
228240
--path /svc1/authentication/login

mysql-test/suite/router/r/authentication_mrs_get_cookie.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ OK
8989

9090
#
9191
# III.1
92+
Check no access for non existing user
9293
GET /svc1/authentication/login
9394
{"message":"Unauthorized","status":"401"}
9495
OK
96+
Check the username is case-sensitive
97+
GET /svc1/authentication/login
98+
{"message":"Unauthorized","status":"401"}
99+
OK
100+
Check no access with bad password
95101
GET /svc1/authentication/login
96102
{"message":"Unauthorized","status":"401"}
97103
OK

mysql-test/suite/router/r/authentication_mrs_get_jwt.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ OK
8989

9090
#
9191
# III.1
92+
Check no access for non existing user
9293
GET /svc1/authentication/login
9394
{"message":"Unauthorized","status":"401"}
9495
OK
96+
Check the username is case-sensitive
97+
GET /svc1/authentication/login
98+
{"message":"Unauthorized","status":"401"}
99+
OK
100+
Check no access with bad password
95101
GET /svc1/authentication/login
96102
{"message":"Unauthorized","status":"401"}
97103
OK

mysql-test/suite/router/r/authentication_mrs_post_cookie.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ OK
8989

9090
#
9191
# III.1
92+
Check no access for non existing user
9293
GET /svc1/authentication/login
9394
{"message":"Unauthorized","status":"401"}
9495
OK
96+
Check the username is case-sensitive
97+
GET /svc1/authentication/login
98+
{"message":"Unauthorized","status":"401"}
99+
OK
100+
Check no access with bad password
95101
GET /svc1/authentication/login
96102
{"message":"Unauthorized","status":"401"}
97103
OK

mysql-test/suite/router/r/authentication_mrs_post_jwt.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ OK
8989

9090
#
9191
# III.1
92+
Check no access for non existing user
9293
GET /svc1/authentication/login
9394
{"message":"Unauthorized","status":"401"}
9495
OK
96+
Check the username is case-sensitive
97+
GET /svc1/authentication/login
98+
{"message":"Unauthorized","status":"401"}
99+
OK
100+
Check no access with bad password
95101
GET /svc1/authentication/login
96102
{"message":"Unauthorized","status":"401"}
97103
OK

mysql-test/suite/router/r/authentication_mrs_post_jwt_multiple_handlers.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,15 @@ OK
9090

9191
#
9292
# III.1
93+
Check no access for non existing user
9394
GET /svc1/authentication/login
9495
{"message":"Unauthorized","status":"401"}
9596
OK
97+
Check the username is case-sensitive
98+
GET /svc1/authentication/login
99+
{"message":"Unauthorized","status":"401"}
100+
OK
101+
Check no access with bad password
96102
GET /svc1/authentication/login
97103
{"message":"Unauthorized","status":"401"}
98104
OK

router/src/mysql_rest_service/src/mrs/database/query_entry_auth_user.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ bool QueryEntryAuthUser::query_user(MySQLSession *session,
8282
}
8383

8484
if (!user_data->name.empty()) {
85+
// we force a case-sensitive comparison here
8586
query_ << (mysqlrouter::sqlstring("and convert(name using utf8)=? "
86-
"COLLATE \"utf8mb4_general_ci\"")
87+
"COLLATE \"utf8mb4_bin\"")
8788
<< user_data->name);
8889
break;
8990
}

0 commit comments

Comments
 (0)