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
cd7ef438
Commit
cd7ef438
authored
6 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
clearer logging when things fail, too
parent
806964b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/federation/federation_base.py
+27
-7
27 additions, 7 deletions
synapse/federation/federation_base.py
synapse/storage/keys.py
+1
-0
1 addition, 0 deletions
synapse/storage/keys.py
with
28 additions
and
7 deletions
synapse/federation/federation_base.py
+
27
−
7
View file @
cd7ef438
...
@@ -143,11 +143,31 @@ class FederationBase(object):
...
@@ -143,11 +143,31 @@ class FederationBase(object):
def
callback
(
_
,
pdu
):
def
callback
(
_
,
pdu
):
with
logcontext
.
PreserveLoggingContext
(
ctx
):
with
logcontext
.
PreserveLoggingContext
(
ctx
):
if
not
check_event_content_hash
(
pdu
):
if
not
check_event_content_hash
(
pdu
):
logger
.
warn
(
# let's try to distinguish between failures because the event was
"
Event content has been tampered, redacting %s: %s
"
,
# redacted (which are somewhat expected) vs actual ball-tampering
pdu
.
event_id
,
pdu
.
get_pdu_json
()
# incidents.
)
#
return
prune_event
(
pdu
)
# This is just a heuristic, so we just assume that if the keys are
# about the same between the redacted and received events, then the
# received event was probably a redacted copy (but we then use our
# *actual* redacted copy to be on the safe side.)
redacted_event
=
prune_event
(
pdu
)
if
(
set
(
six
.
iterkeys
(
redacted_event
))
==
set
(
six
.
iterkeys
(
pdu
))
and
set
(
six
.
iterkeys
(
redacted_event
.
content
))
==
set
(
six
.
iterkeys
(
pdu
.
content
))
):
logger
.
info
(
"
Event %s seems to have been redacted; using our redacted
"
"
copy
"
,
pdu
.
event_id
,
)
else
:
logger
.
warning
(
"
Event %s content has been tampered, redacting
"
,
pdu
.
event_id
,
pdu
.
get_pdu_json
(),
)
return
redacted_event
if
self
.
spam_checker
.
check_event_for_spam
(
pdu
):
if
self
.
spam_checker
.
check_event_for_spam
(
pdu
):
logger
.
warn
(
logger
.
warn
(
...
@@ -162,8 +182,8 @@ class FederationBase(object):
...
@@ -162,8 +182,8 @@ class FederationBase(object):
failure
.
trap
(
SynapseError
)
failure
.
trap
(
SynapseError
)
with
logcontext
.
PreserveLoggingContext
(
ctx
):
with
logcontext
.
PreserveLoggingContext
(
ctx
):
logger
.
warn
(
logger
.
warn
(
"
Signature check failed for %s
"
,
"
Signature check failed for
%s:
%s
"
,
pdu
.
event_id
,
pdu
.
event_id
,
failure
.
getErrorMessage
(),
)
)
return
failure
return
failure
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/keys.py
+
1
−
0
View file @
cd7ef438
...
@@ -134,6 +134,7 @@ class KeyStore(SQLBaseStore):
...
@@ -134,6 +134,7 @@ class KeyStore(SQLBaseStore):
"""
"""
key_id
=
"
%s:%s
"
%
(
verify_key
.
alg
,
verify_key
.
version
)
key_id
=
"
%s:%s
"
%
(
verify_key
.
alg
,
verify_key
.
version
)
# XXX fix this to not need a lock (#3819)
def
_txn
(
txn
):
def
_txn
(
txn
):
self
.
_simple_upsert_txn
(
self
.
_simple_upsert_txn
(
txn
,
txn
,
...
...
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