mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 01:13:10 -06:00
Add checks
This commit is contained in:
parent
40a8d732fd
commit
f423e9d052
|
|
@ -109,6 +109,23 @@ func ExchangeThirdPartyInvite(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that the state key is correct.
|
||||||
|
_, targetDomain, err := gomatrixserverlib.SplitID('@', *builder.StateKey)
|
||||||
|
if err != nil {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: 400,
|
||||||
|
JSON: jsonerror.BadJSON("The event's state key isn't a Matrix user ID"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the target user is from the requesting homeserver.
|
||||||
|
if targetDomain != request.Origin() {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: 400,
|
||||||
|
JSON: jsonerror.BadJSON("The event's state key doesn't have the same domain as the request's origin"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Auth and build the event from what the remote server sent us
|
// Auth and build the event from what the remote server sent us
|
||||||
event, err := buildMembershipEvent(&builder, queryAPI, cfg)
|
event, err := buildMembershipEvent(&builder, queryAPI, cfg)
|
||||||
if err == errNotInRoom {
|
if err == errNotInRoom {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue