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
Built on top of #8231. Fix for an issue with the internals of session
expiration discussed in
#8137 (comment).
When I added ID primary keys to sessions and tokens, I changed the
session delete method on the Session trait to operate by ID as well, and
that meant a more complex authz situation compared to deleting by token.
A bearer token is its own authz, at least according to the implicit
policy we decided on. When I changed it to delete by ID, I made the
delete function (now removed in this PR) use the user ID from the
`opctx` to filter tokens to ensure that users could only delete their
own sessions.
The problem is that the `opctx` used in that case is the external
authenticator op context, which has its own special actor that is
distinct from the user in question. This means we would never actually
delete a token this way because the query would always come up empty.
This is not actually a problem from a correctness point of view because
on subsequent requests we always check the expiration time on the
session we pull out of the DB anyway. But it does mean that we probably
end up with a lot more sessions piling up in the DB than we otherwise
would. Not a big deal either way, but I feel more comfortable having it
keep working the way it has worked for several years.
It's also nice that we are deleting some app code here and replacing it
with a test for a behavior that was previously untested. (I added the
test in the first commit and confirmed that it fails without the changes
from the second commit.)
0 commit comments