Skip to content

Fix #2672 - Connect signed PuSH subscription requests to instance domain#4205

Merged
Gargron merged 3 commits intomasterfrom
feature-signed-subscriptions
Jul 14, 2017
Merged

Fix #2672 - Connect signed PuSH subscription requests to instance domain#4205
Gargron merged 3 commits intomasterfrom
feature-signed-subscriptions

Conversation

@Gargron
Copy link
Copy Markdown
Member

@Gargron Gargron commented Jul 14, 2017

Resolves #2739

@Gargron Gargron requested a review from ClearlyClaire July 14, 2017 18:59
@Gargron
Copy link
Copy Markdown
Member Author

Gargron commented Jul 14, 2017

Bonus round: at the cost of backward compatibility, we could require that the domain field be filled, or not send private toots to it - that way we'd get rid of the non-Mastodon instances getting private toots issue. But that's up for debate since it'd exclude outdated Mastodon instances too

Copy link
Copy Markdown
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from one corner case that is not new to this PR, looks good to me.

@domains.include?(Addressable::URI.parse(callback_url).host)
def allowed_to_receive?(callback_url, domain)
(!domain.nil? && @domains.include?(domain)) || @domains.include?(Addressable::URI.parse(callback_url).host)
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not new to this PR, but I think you actually want .normalized_host instead of .host.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, callback_url is normalized before save.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, seems to be the case, indeed.

@Gargron
Copy link
Copy Markdown
Member Author

Gargron commented Jul 14, 2017

Ah, I didn't adjust the tests.

Also, the method signature having so many params does look bad, but I dunno how to improve it.

@ClearlyClaire
Copy link
Copy Markdown
Contributor

@Gargron I'm not completely against enforcing the subscription requests to be signed for private toot delivery, but I think this should be done in a later release, exactly for the reasons you mentioned.

@Gargron Gargron merged commit cd9b2ab into master Jul 14, 2017
@Gargron Gargron deleted the feature-signed-subscriptions branch July 14, 2017 21:01
abcang pushed a commit to pixiv/mastodon that referenced this pull request Aug 22, 2017
…ance domain (mastodon#4205)

* Fix mastodon#2672 - Connect signed PuSH subscription requests to instance domain

Resolves mastodon#2739

* Fix return of locate_subscription

* Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants