Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
7a654622
Commit
7a654622
authored
7 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Device deletion: check UI auth matches access token
(otherwise there's no point in the UI auth)
parent
92f68088
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/client/v2_alpha/devices.py
+8
-5
8 additions, 5 deletions
synapse/rest/client/v2_alpha/devices.py
with
8 additions
and
5 deletions
synapse/rest/client/v2_alpha/devices.py
+
8
−
5
View file @
7a654622
...
...
@@ -117,6 +117,8 @@ class DeviceRestServlet(servlet.RestServlet):
@defer.inlineCallbacks
def
on_DELETE
(
self
,
request
,
device_id
):
requester
=
yield
self
.
auth
.
get_user_by_req
(
request
)
try
:
body
=
servlet
.
parse_json_object_from_request
(
request
)
...
...
@@ -135,11 +137,12 @@ class DeviceRestServlet(servlet.RestServlet):
if
not
authed
:
defer
.
returnValue
((
401
,
result
))
requester
=
yield
self
.
auth
.
get_user_by_req
(
request
)
yield
self
.
device_handler
.
delete_device
(
requester
.
user
.
to_string
(),
device_id
,
)
# check that the UI auth matched the access token
user_id
=
result
[
constants
.
LoginType
.
PASSWORD
]
if
user_id
!=
requester
.
user
.
to_string
():
raise
errors
.
AuthError
(
403
,
"
Invalid auth
"
)
yield
self
.
device_handler
.
delete_device
(
user_id
,
device_id
)
defer
.
returnValue
((
200
,
{}))
@defer.inlineCallbacks
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment