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
e10c5279
Commit
e10c5279
authored
8 years ago
by
Matthew
Browse files
Options
Downloads
Patches
Plain Diff
Discard PDUs from invalid origins due to #1753 in 0.18.[56]
parent
2f5be2d8
No related branches found
Branches containing commit
Tags
v0.18.7-rc1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/federation/federation_server.py
+23
-1
23 additions, 1 deletion
synapse/federation/federation_server.py
with
23 additions
and
1 deletion
synapse/federation/federation_server.py
+
23
−
1
View file @
e10c5279
...
...
@@ -23,6 +23,7 @@ from synapse.util.async import Linearizer
from
synapse.util.logutils
import
log_function
from
synapse.util.caches.response_cache
import
ResponseCache
from
synapse.events
import
FrozenEvent
from
synapse.types
import
get_domain_from_id
import
synapse.metrics
from
synapse.api.errors
import
AuthError
,
FederationError
,
SynapseError
...
...
@@ -132,7 +133,7 @@ class FederationServer(FederationBase):
if
response
:
logger
.
debug
(
"
[%s] We
'
ve already responed to this request
"
,
"
[%s] We
'
ve already respon
d
ed to this request
"
,
transaction
.
transaction_id
)
defer
.
returnValue
(
response
)
...
...
@@ -475,6 +476,27 @@ class FederationServer(FederationBase):
@defer.inlineCallbacks
@log_function
def
_handle_new_pdu
(
self
,
origin
,
pdu
,
get_missing
=
True
):
# check that it's actually being sent from a valid destination to
# workaround bug #1753 in 0.18.5 and 0.18.6
if
origin
!=
get_domain_from_id
(
pdu
.
event_id
):
if
not
(
pdu
.
type
==
'
m.room.member
'
and
pdu
.
content
and
pdu
.
content
.
get
(
"
membership
"
,
None
)
==
'
join
'
and
self
.
hs
.
is_mine_id
(
pdu
.
state_key
)
):
logger
.
info
(
"
Discarding PDU %s from invalid origin %s
"
,
pdu
.
event_id
,
origin
)
return
else
:
logger
.
info
(
"
Accepting join PDU %s from %s
"
,
pdu
.
event_id
,
origin
)
# We reprocess pdus when we have seen them only as outliers
existing
=
yield
self
.
_get_persisted_pdu
(
origin
,
pdu
.
event_id
,
do_auth
=
False
...
...
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