-
Notifications
You must be signed in to change notification settings - Fork 60
Check that invalid PDUs are ignored, instead of erroring out #1399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
reivilibre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good overall, just checking some things
tests/50federation/51transactions.pl
Outdated
| # be handled properly. | ||
| # | ||
| # This enforces that the entire transaction is rejected if a single bad PDU is | ||
| # sent. It is unclear if this is the correct behavior or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix comment ^^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5359ab1
| method => "GET", | ||
| uri => "/v3/rooms/$room_id/event/$event_id", | ||
| )->main::expect_m_not_found | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we expect an error in the PDU processing result for the bad PDU?: https://spec.matrix.org/v1.14/server-server-api/#put_matrixfederationv1sendtxnid_response-200_pdu-processing-result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an open question; the sending homeserver technically can't do anything with that information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why we don't yet assert on the /send response body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on. I'm curious if this test now fails for other homeserver implementations...
If it does, I suggest notifying the maintainers and adjusting the relevant test blacklist.
tests/50federation/51transactions.pl
Outdated
| # be handled properly. | ||
| # | ||
| # This enforces that the entire transaction is rejected if a single bad PDU is | ||
| # sent. It is unclear if this is the correct behavior or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update this comment as well? Perhaps say that the transaction should succeed, but it's unclear whether the response body should contain the invalid event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Wait for the good event to be sent down through sync | ||
| await_sync_timeline_contains( $creator, $room_id, check => sub { | ||
| my ( $event ) = @_; | ||
| $event->{type} eq "m.room.message" && | ||
| $event->{content}{body} eq "Good event" | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also check that we don't receive the bad event down sync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find utilities to make sure that the sync timeline doesn't contain something :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be just adding && $event->{content}{body} neq "Bad event"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only checks if one event in the timeline checks that constraint
Dendrite indeed fails. I've made implementation specific tests in a10eebc |
anoadragon453
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM other than potentially fixing the nit in #1399 (comment).
Dendrite appears to still be failing, as it's failing to find this test? https://github.com/matrix-org/sytest/actions/runs/14194392227/job/39766068369?pr=1399#step:6:9
|
@anoadragon453 fixed the test, that was a typo 7e2a47e |
This is similar to #1391, but it doesn't assert on the /send body response, and rather looks at events persisted through /sync and /events