You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing an invalid continuation term to an index search crashes the API server.
The riak_index:decode_continuation/2 call will fail if the passed term can't be converted to binary:
%% @doc decode a continuation received from the outside world.
-specdecode_continuation(continuation() | undefined) ->last_result() | undefined.
decode_continuation(undefined) ->undefined;
decode_continuation(Bin) ->binary_to_term(base64:decode(Bin)).
If the passed term is invalid, the invocation will raise an exception:
For the HTTP API it is better to validate inputs in the riak_kv_wm_index:malformed_request/2 callback, and then a correct 4xx response code will be returned if it is invalid.
So we probably should decode the continuation within the API, with a try .. catch clause as you suggest, and pass only correctly decoded continuations to the riak_index:to_index_query/2 function.
Please note that I triggered the crash using the erlang grpc client and the continuation value I passed was an empty binary. So the error return value semantic might be bad_continuation_type and bad_continuation_value to handle both cases.
Passing an invalid
continuation
term to an index search crashes the API server.The
riak_index:decode_continuation/2
call will fail if the passed term can't be converted to binary:If the passed term is invalid, the invocation will raise an exception:
The text was updated successfully, but these errors were encountered: