MatrixSynapse/tests
Patrick Cloke e746f80b4f
Do not accept pattern_type from user input in push rules. (#15088)
Internally the push rules module uses a `pattern_type` property for `event_match`
conditions (and `related_event_match`) to mark the condition as matching the
current user's Matrix ID or localpart.

This is leaky to the Client-Server API where a user can successfully set a condition
which provides `pattern_type` instead of `pattern` (note that there's no benefit to
doing this -- the user can just use their own Matrix ID or localpart instead). When
serializing back to the client the `pattern_type` property is converted into a proper
`pattern`.

The following changes are made to avoid this:

* Separate the `KnownCondition::EventMatch` enum value into `EventMatch`
  and `EventMatchType`, each with their own expected properties. (Note that a
  similar change is made for `RelatedEventMatch`.)
* Make it such that the `pattern_type` variants serialize to the same condition kind,
  but cannot be deserialized (since they're only provided by base rules).
* As a final tweak, convert `user_id` vs. `user_localpart` values into an enum.
2023-02-28 10:11:20 -05:00
..
api
app
appservice
config
crypto
events
federation Bump black from 22.12.0 to 23.1.0 (#15103) 2023-02-22 15:29:09 -05:00
handlers Batch up storing state groups when creating new room (#14918) 2023-02-24 13:15:29 -08:00
http Bump black from 22.12.0 to 23.1.0 (#15103) 2023-02-22 15:29:09 -05:00
logging
media Refactor media modules. (#15146) 2023-02-27 08:26:05 -05:00
metrics
module_api
push Do not accept pattern_type from user input in push rules. (#15088) 2023-02-28 10:11:20 -05:00
replication Bump black from 22.12.0 to 23.1.0 (#15103) 2023-02-22 15:29:09 -05:00
rest Admin API endpoint to delete a reported event (#15116) 2023-02-28 12:09:10 +00:00
scripts
server_notices Bump black from 22.12.0 to 23.1.0 (#15103) 2023-02-22 15:29:09 -05:00
state
storage Batch up storing state groups when creating new room (#14918) 2023-02-24 13:15:29 -08:00
test_utils
types
util
__init__.py
server.py
test_distributor.py
test_event_auth.py
test_federation.py
test_mau.py Bump black from 22.12.0 to 23.1.0 (#15103) 2023-02-22 15:29:09 -05:00
test_phone_home.py
test_rust.py
test_server.py
test_state.py
test_terms_auth.py
test_test_utils.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_types.py
test_visibility.py
unittest.py Batch up storing state groups when creating new room (#14918) 2023-02-24 13:15:29 -08:00
utils.py