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
b5b03b70
Commit
b5b03b70
authored
5 years ago
by
werner291
Committed by
Richard van der Hoff
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add domain validation when creating room with list of invitees (#6121)
parent
9a84d744
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/4088.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/4088.bugfix
synapse/handlers/room.py
+3
-1
3 additions, 1 deletion
synapse/handlers/room.py
tests/rest/client/v1/test_rooms.py
+9
-0
9 additions, 0 deletions
tests/rest/client/v1/test_rooms.py
with
13 additions
and
1 deletion
changelog.d/4088.bugfix
0 → 100644
+
1
−
0
View file @
b5b03b70
Added domain validation when including a list of invitees upon room creation.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/handlers/room.py
+
3
−
1
View file @
b5b03b70
...
...
@@ -28,6 +28,7 @@ from twisted.internet import defer
from
synapse.api.constants
import
EventTypes
,
JoinRules
,
RoomCreationPreset
from
synapse.api.errors
import
AuthError
,
Codes
,
NotFoundError
,
StoreError
,
SynapseError
from
synapse.api.room_versions
import
KNOWN_ROOM_VERSIONS
from
synapse.http.endpoint
import
parse_and_validate_server_name
from
synapse.storage.state
import
StateFilter
from
synapse.types
import
RoomAlias
,
RoomID
,
RoomStreamToken
,
StreamToken
,
UserID
from
synapse.util
import
stringutils
...
...
@@ -554,7 +555,8 @@ class RoomCreationHandler(BaseHandler):
invite_list
=
config
.
get
(
"
invite
"
,
[])
for
i
in
invite_list
:
try
:
UserID
.
from_string
(
i
)
uid
=
UserID
.
from_string
(
i
)
parse_and_validate_server_name
(
uid
.
domain
)
except
Exception
:
raise
SynapseError
(
400
,
"
Invalid user_id: %s
"
%
(
i
,))
...
...
This diff is collapsed.
Click to expand it.
tests/rest/client/v1/test_rooms.py
+
9
−
0
View file @
b5b03b70
...
...
@@ -484,6 +484,15 @@ class RoomsCreateTestCase(RoomBase):
self
.
render
(
request
)
self
.
assertEquals
(
400
,
channel
.
code
)
def
test_post_room_invitees_invalid_mxid
(
self
):
# POST with invalid invitee, see https://github.com/matrix-org/synapse/issues/4088
# Note the trailing space in the MXID here!
request
,
channel
=
self
.
make_request
(
"
POST
"
,
"
/createRoom
"
,
b
'
{
"
invite
"
:[
"
@alice:example.com
"
]}
'
)
self
.
render
(
request
)
self
.
assertEquals
(
400
,
channel
.
code
)
class
RoomTopicTestCase
(
RoomBase
):
"""
Tests /rooms/$room_id/topic REST events.
"""
...
...
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