-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fix push URLs to match the spec. #986
Conversation
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.
in principle this looks good, but it seems like there are more instances of non-compliance.
Sorry about that! I thought I caught all the instances. 😢 |
await_http_request( $PUSH_LOCATION, sub { | ||
my ( $request ) = @_; | ||
my $body = $request->body_from_json; | ||
|
||
# Respond to all requests, even if we filter them out | ||
$request->respond_json( $response // {} ); | ||
|
||
return unless $body->{notification}{type}; | ||
return unless $body->{notification}{type} eq "m.room.message"; | ||
|
||
# Ensure this is the expected pusher. | ||
return unless $body->{notification}{devices}; | ||
return unless $body->{notification}{devices}[0]{pushkey} eq $pushkey; | ||
|
||
# Respond to expected request. | ||
$request->respond_json( $response // {} ); | ||
|
||
return 1; | ||
}); |
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 attempting to check one of the fields of the request instead of differentiating on URL.
This matches matrix-org/synapse#8865 to ensure the push URLs match the spec.