mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 02:24:08 +00:00
use equality to filter token prefixes
otherwise, index isn't used note: this means changing the token prefix size requires revoking all tokens, where before only _increasing_ the token prefix size required doing that.
This commit is contained in:
@@ -528,9 +528,7 @@ class Hashed(Expiring):
|
||||
prefix = token[: cls.prefix_length]
|
||||
# since we can't filter on hashed values, filter on prefix
|
||||
# so we aren't comparing with all tokens
|
||||
prefix_match = db.query(cls).filter(
|
||||
bindparam('prefix', prefix).startswith(cls.prefix)
|
||||
)
|
||||
prefix_match = db.query(cls).filter_by(prefix=prefix)
|
||||
prefix_match = prefix_match.filter(
|
||||
or_(cls.expires_at == None, cls.expires_at >= cls.now())
|
||||
)
|
||||
|
Reference in New Issue
Block a user