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:
commit
c3ac53eb43
|
@ -1088,7 +1088,7 @@ next_ds_cursor(Iter) ->
|
||||||
}.
|
}.
|
||||||
|
|
||||||
parse_cursor(CursorBin, Nodes) ->
|
parse_cursor(CursorBin, Nodes) ->
|
||||||
try base64:decode(CursorBin, #{mode => urlsafe, padding => false}) of
|
try emqx_base62:decode(CursorBin) of
|
||||||
Bin ->
|
Bin ->
|
||||||
parse_cursor1(Bin, Nodes)
|
parse_cursor1(Bin, Nodes)
|
||||||
catch
|
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}
|
#{?CURSOR_ETS_NODE_IDX => NodeIdx, ?CURSOR_ETS_CONT => Cont}
|
||||||
],
|
],
|
||||||
Bin = term_to_binary(Cursor0, [{compressed, 9}]),
|
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}) ->
|
serialize_cursor(#{type := ?CURSOR_TYPE_DS, iterator := Iter}) ->
|
||||||
Cursor0 = [?CURSOR_VSN1, ?CURSOR_TYPE_DS, Iter],
|
Cursor0 = [?CURSOR_VSN1, ?CURSOR_TYPE_DS, Iter],
|
||||||
Bin = term_to_binary(Cursor0, [{compressed, 9}]),
|
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
|
%% 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.
|
%% selecting/fuzzy filters, and also reutilize its BPAPI for selecting rows.
|
||||||
|
|
|
@ -1673,7 +1673,7 @@ t_list_clients_v2(Config) ->
|
||||||
%% Verify that a malicious cursor that could generate an atom on the node is
|
%% Verify that a malicious cursor that could generate an atom on the node is
|
||||||
%% rejected
|
%% rejected
|
||||||
EvilAtomBin0 = <<131, 100, 0, 5, "some_atom_that_doesnt_exist_on_the_remote_node">>,
|
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(
|
?assertMatch(
|
||||||
{error, {{_, 400, _}, _, #{<<"message">> := <<"bad cursor">>}}},
|
{error, {{_, 400, _}, _, #{<<"message">> := <<"bad cursor">>}}},
|
||||||
|
|
Loading…
Reference in New Issue