Merge pull request #12848 from thalesmg/fix-another-b64-fn-m-20240408

fix(clients api): use alternative base64 function for OTP 25
This commit is contained in:
Thales Macedo Garitezi 2024-04-08 15:15:49 -03:00 committed by GitHub
commit c3ac53eb43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -1088,7 +1088,7 @@ next_ds_cursor(Iter) ->
}.
parse_cursor(CursorBin, Nodes) ->
try base64:decode(CursorBin, #{mode => urlsafe, padding => false}) of
try emqx_base62:decode(CursorBin) of
Bin ->
parse_cursor1(Bin, Nodes)
catch
@ -1133,11 +1133,11 @@ serialize_cursor(#{type := ?CURSOR_TYPE_ETS, node_idx := NodeIdx, cont := Cont})
#{?CURSOR_ETS_NODE_IDX => NodeIdx, ?CURSOR_ETS_CONT => Cont}
],
Bin = term_to_binary(Cursor0, [{compressed, 9}]),
base64:encode(Bin, #{mode => urlsafe, padding => false});
emqx_base62:encode(Bin);
serialize_cursor(#{type := ?CURSOR_TYPE_DS, iterator := Iter}) ->
Cursor0 = [?CURSOR_VSN1, ?CURSOR_TYPE_DS, Iter],
Bin = term_to_binary(Cursor0, [{compressed, 9}]),
base64:encode(Bin, #{mode => urlsafe, padding => false}).
emqx_base62:encode(Bin).
%% An adapter function so we can reutilize all the logic in `emqx_mgmt_api' for
%% selecting/fuzzy filters, and also reutilize its BPAPI for selecting rows.

View File

@ -1673,7 +1673,7 @@ t_list_clients_v2(Config) ->
%% Verify that a malicious cursor that could generate an atom on the node is
%% rejected
EvilAtomBin0 = <<131, 100, 0, 5, "some_atom_that_doesnt_exist_on_the_remote_node">>,
EvilAtomBin = base64:encode(EvilAtomBin0, #{mode => urlsafe, padding => false}),
EvilAtomBin = emqx_base62:encode(EvilAtomBin0),
?assertMatch(
{error, {{_, 400, _}, _, #{<<"message">> := <<"bad cursor">>}}},