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 Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
appservice Fix-up type hints in tests/server.py. (#15084) 2023-02-17 18:19:38 +00:00
config
crypto Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
events Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
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 Use mypy 1.0 (#15052) 2023-02-16 16:09:11 +00:00
media Refactor media modules. (#15146) 2023-02-27 08:26:05 -05:00
metrics
module_api Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
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 Add more missing type hints to tests. (#15028) 2023-02-08 16:29:49 -05:00
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 Add a class UnpersistedEventContext to allow for the batching up of storing state groups (#14675) 2023-02-09 13:05:02 -08:00
types
util Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
__init__.py
server.py Fix-up type hints in tests/server.py. (#15084) 2023-02-17 18:19:38 +00:00
test_distributor.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_event_auth.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_federation.py Remove unused `room_alias` field from `/createRoom` response (#15093) 2023-02-22 11:07:28 +00:00
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 Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
test_rust.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
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 Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_visibility.py Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
unittest.py Batch up storing state groups when creating new room (#14918) 2023-02-24 13:15:29 -08:00
utils.py Use mypy 1.0 (#15052) 2023-02-16 16:09:11 +00:00