element-hq / element-hq/synapse

Soft-failures make federated bans racy and frustrate redaction

Open
#9,329 3 comments 0 reactions 0 assignees View on GitHub
A-Federation A-Moderation A-Redactions O-Occasional S-Major T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#9329](https://github.com/matrix-org/synapse/issues/9329).

---

I've come across this issue twice in two days:

- A user joins over federation and spams messages into the room
- Mjolnir bans the user and redacts their messages
- Users from other homeservers report that an unredacted message remains, but my homeserver doesn't have it

I think the issue is:

- Synapse soft-fails a message from the banned user that other homeservers have accepted
- ⇒ Redaction of this message is now impossible

A sample is below. Mjolnir's FirstMessageIsImageProtection banned and redacted the user after they sent three images, but their fourth image is soft-failed, making redaction impossible.

archlinux.org rejected the message:

```
[root@matrix ~]# journalctl --since='3 hours ago' | grep "\$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io"
Feb 04 14:04:17 matrix.archlinux.org synapse[56716]: synapse.handlers.federation: [PUT-159337-$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io] handling received PDU:
Feb 04 14:04:17 matrix.archlinux.org synapse[56716]: synapse.state: [PUT-159337-$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io] Resolving state for !SEgsRQLScqPxYtucHl:archlinux.org with groups [2601779, 2601782]
Feb 04 14:04:18 matrix.archlinux.org synapse[56716]: synapse.handlers.federation: [PUT-159337-$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io] Soft-failing because 403: User [bad-user] not in room !SEgsRQLScqPxYtucHl:archlinux.org ()
Feb 04 14:04:18 matrix.archlinux.org synapse[56716]: synapse.http.client: [PUT-159337-$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io] Received response to POST http://127.0.0.1:9093/_synapse/replication/fed_send_events/cxkgfQOzda: 200
```

aria-net.org accepted the message:
```
:~$ grep "\$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io" /var/log/syslog
Feb 4 14:04:17 akademeia matrix-synapse-worker_federation_reader_1[189517]: 2021-02-04 14:04:17,116 - synapse.handlers.federation - 189 - INFO - PUT-19046-$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io - handling received PDU:
Feb 4 14:04:17 akademeia matrix-synapse-worker_federation_reader_1[189517]: 2021-02-04 14:04:17,822 - synapse.http.client - 425 - INFO - PUT-19046-$WM5mW7VqMvW19ceHPt1r-jrLCPJE8pGCVXfVZKQ47io - Received response to POST http://127.0.0.1:8101/_synapse/replication/fed_send_events/cItXxahwLx: 200
```

### Version information

- **Homeserver**: matrix.archlinux.org
- **Version**: `{"server_version":"1.26.0","python_version":"3.9.1"}`
- **Install method**: pip
- **Platform**: Arch Linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.