anonymousland-synapse/tests/push
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
..
__init__.py Write some tests for the email pusher (#4095) 2018-10-30 23:55:43 +11:00
test_bulk_push_rule_evaluator.py Batch up storing state groups when creating new room (#14918) 2023-02-24 13:15:29 -08:00
test_email.py Add module API callbacks for adding and deleting local 3PID associations (#15044 2023-02-27 14:19:19 +00:00
test_http.py Add final type hint to tests.unittest. (#15072) 2023-02-14 14:03:35 -05:00
test_presentable_names.py Fix-up type hints for tests.push module. (#14816) 2023-01-11 07:35:40 -05:00
test_push_rule_evaluator.py Do not accept pattern_type from user input in push rules. (#15088) 2023-02-28 10:11:20 -05:00