fix(persistent_sessions): protect against looking up stale data

This commit is contained in:
Tobias Lindahl 2021-11-01 13:50:16 +01:00
parent 329dd4d780
commit ce49a281ed
1 changed files with 11 additions and 6 deletions

View File

@ -179,6 +179,10 @@ timestamp_from_conninfo(ConnInfo) ->
end. end.
lookup(ClientID) when is_binary(ClientID) -> lookup(ClientID) when is_binary(ClientID) ->
case is_store_enabled() of
false ->
none;
true ->
case lookup_session_store(ClientID) of case lookup_session_store(ClientID) of
none -> none; none -> none;
{value, #session_store{session = S} = SS} -> {value, #session_store{session = S} = SS} ->
@ -186,6 +190,7 @@ lookup(ClientID) when is_binary(ClientID) ->
expired -> {expired, S}; expired -> {expired, S};
persistent -> {persistent, S} persistent -> {persistent, S}
end end
end
end. end.
-spec discard_if_present(binary()) -> 'ok'. -spec discard_if_present(binary()) -> 'ok'.