Skip to content

Commit 29437d0

Browse files
committed
Restrict username and password in AMQPLAIN
Restrict both username and password in SASL mechanism AMQPLAIN to be a binary.
1 parent dbf498a commit 29437d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

deps/rabbit/src/rabbit_auth_mechanism_amqplain.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ should_offer(_Sock) ->
3030
init(_Sock) ->
3131
[].
3232

33-
-define(IS_STRING_TYPE(Type), Type =:= longstr orelse Type =:= shortstr).
33+
-define(IS_STRING_TYPE(Type),
34+
Type =:= longstr orelse
35+
Type =:= shortstr orelse
36+
Type =:= binary).
3437

3538
handle_response(Response, _State) ->
3639
LoginTable = rabbit_binary_parser:parse_table(Response),
3740
case {lists:keysearch(<<"LOGIN">>, 1, LoginTable),
3841
lists:keysearch(<<"PASSWORD">>, 1, LoginTable)} of
3942
{{value, {_, UserType, User}},
40-
{value, {_, PassType, Pass}}} when ?IS_STRING_TYPE(UserType);
43+
{value, {_, PassType, Pass}}} when ?IS_STRING_TYPE(UserType) andalso
4144
?IS_STRING_TYPE(PassType) ->
4245
rabbit_access_control:check_user_pass_login(User, Pass);
4346
{{value, {_, _UserType, _User}},

0 commit comments

Comments
 (0)