element-hq / element-hq/synapse

check_event_allowed callback from the module API cause a TypeError

Open
#18,101 0 comments 0 reactions 0 assignees View on GitHub
A-Modules
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

`ThirdPartyEventRulesModuleApiCallbacks.check_event_allowed()` freezes incoming events for safety purpose, but the Rust implementation of `PushRuleEvaluator` doesn't seem to handle `immutabledict`.

### Steps to reproduce

1. extend the server config with
```yaml
default_power_level_content_override:
public_chat:
notifications:
room: 0
```
1. register a module which register a `check_event_allowed callback`. The callback could do nothing, eg: return (True, None)
1. try to create a public room to see the bug

### Homeserver

a local homeserver

### Synapse Version

v1.122.0

### Installation Method

Docker (matrixdotorg/synapse)

### Database

PostgreSQL 15

### Workers

Single process

### Platform

Ubuntu 24.04

### Configuration

_No response_

### Relevant log output

```shell
File "/usr/local/lib/python3.12/site-packages/synapse/push/bulk_push_rule_evaluator.py", line 429, in _action_for_event_by_user
evaluator = PushRuleEvaluator(
^^^^^^^^^^^^^^^^^^
TypeError: argument 'notification_power_levels': 'immutabledict' object cannot be converted to 'PyDict'
```

### Anything else that would be useful to know?

_No response_

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.