Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Do not accept pattern_type from user input in push rules #15088

Merged
merged 12 commits into from
Feb 28, 2023
1 change: 1 addition & 0 deletions changelog.d/15088.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug where Synapse handled an unspecced field on push rules.
9 changes: 3 additions & 6 deletions rust/benches/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ fn bench_match_exact(b: &mut Bencher) {
let condition = Condition::Known(synapse::push::KnownCondition::EventMatch(
EventMatchCondition {
key: "room_id".into(),
pattern: Some("!room:server".into()),
pattern_type: None,
pattern: "!room:server".into(),
},
));

Expand Down Expand Up @@ -109,8 +108,7 @@ fn bench_match_word(b: &mut Bencher) {
let condition = Condition::Known(synapse::push::KnownCondition::EventMatch(
EventMatchCondition {
key: "content.body".into(),
pattern: Some("test".into()),
pattern_type: None,
pattern: "test".into(),
},
));

Expand Down Expand Up @@ -158,8 +156,7 @@ fn bench_match_word_miss(b: &mut Bencher) {
let condition = Condition::Known(synapse::push::KnownCondition::EventMatch(
EventMatchCondition {
key: "content.body".into(),
pattern: Some("foobar".into()),
pattern_type: None,
pattern: "foobar".into(),
},
));

Expand Down
Loading