Skip to content

Commit 0aec251

Browse files
committed
Fix token impersonation vulnerability
Signed-off-by: Patrik Dufresne <[email protected]>
1 parent 46007ed commit 0aec251

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ We are passionate about developing and maintaining this open-source project to m
128128

129129
# Changelog
130130

131+
# 2.10.6 (2025-10-02)
132+
133+
* Security: fix token impersonation vulnerability.
134+
135+
# 2.10.5 (2025-06-20)
136+
137+
* Send deprecation warning into the logs
138+
131139
# 2.10.4 (2025-06-13)
132140

133141
* **New Features:**

rdiffweb/controller/tests/test_api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ def test_auth_with_access_token(self):
205205
# Then authentication is successful
206206
self.assertStatus('200 OK')
207207

208+
def test_auth_with_access_token_different_user(self):
209+
# Given a user with an access token
210+
userobj = UserObject.add_user('testuser', 'password')
211+
userobj.commit()
212+
token = userobj.add_access_token('test2').encode('ascii')
213+
userobj.commit()
214+
# When using this token to authenticated with /api
215+
self.getPage('/api/', headers=[("Authorization", "Basic " + b64encode(b"admin:" + token).decode('ascii'))])
216+
# Then authentication is successful
217+
self.assertStatus(401)
218+
208219
def test_auth_failed_with_mfa_enabled(self):
209220
# Given a user with MFA enabled
210221
userobj = UserObject.get_user(self.USERNAME)

rdiffweb/core/model/_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def validate_access_token(self, token):
501501
"""
502502
Check if the given token matches.
503503
"""
504-
for access_token in Token.query.all():
504+
for access_token in Token.query.filter(Token.user == self).all():
505505
if access_token.is_expired:
506506
continue
507507
if check_password(token, access_token.hash_token):

0 commit comments

Comments
 (0)