Skip to content
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

Use Contact User as Relay, Report, Subscribe. #9661

Merged
merged 6 commits into from
Jan 5, 2019

Conversation

yukimochi
Copy link
Contributor

Following relay, sending report and subscribing are used user selected by Account.local.where(suspend: false) in Mastodon.
This method may give responsibility someone who does not know anything.
Use Contact User if set.

@@ -68,7 +68,7 @@ def unfollow_activity(activity_id)
end

def some_local_account
@some_local_account ||= Account.local.find_by(suspended: false)
@some_local_account ||= Account.find_local(Setting.site_contact_username.gsub(/\A@/, '')) || Account.local.find_by(suspended: false)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps create Account.representative method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.
Sorry for many force-pushes, all done.

@yukimochi yukimochi force-pushed the use-contact-username branch 2 times, most recently from dda40e0 to 00c4f51 Compare December 30, 2018 09:15
@@ -43,7 +43,7 @@ def subscription_params
end

def some_local_account
@some_local_account ||= Account.local.where(suspended: false).first
@some_local_account ||= Account.representative || Account.local.where(suspended: false).first
Copy link
Member

Choose a reason for hiding this comment

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

no reason to use Account.representative here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Certainly, that's right.

@nightpool
Copy link
Member

I'm a little nervous about using some_local_account or Account.representative interchangeably—if we're saying relay subscription confers responsibility in some way, then the silent fallback could be dangerous. Certainly federated reports do confer responsibility. But at the same time, we can't expect that all instances have a contact_username set.

I think we should resolve this by having a "server" actor as suggested a couple of times when the relay and federated reports were being developed—the combined usecases of relays and federated reports make this make sense, even if we wouldn't want the complexity for either alone.

@ClearlyClaire
Copy link
Contributor

A server actor would also enable authenticating fetches without compromising privacy too much (for non-single-user instances at least).
This (combined with dropping LDS) would pave the way for stricter control of who gets to see toots (even public ones), allowing stronger instance blocks.

@@ -4,6 +4,10 @@ module AccountFinderConcern
extend ActiveSupport::Concern

class_methods do
def representative!
Copy link
Member

Choose a reason for hiding this comment

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

Since this is not used anywhere, I do not think it is required.

@@ -12,6 +16,10 @@ def find_remote!(username, domain)
find_remote(username, domain) || raise(ActiveRecord::RecordNotFound)
end

def representative
find_local(Setting.site_contact_username.gsub(/\A@/, ''))
Copy link
Member

Choose a reason for hiding this comment

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

I believe the || Account.local.find_by(suspended: false) logic should be included here, since it is repeated everywhere this method is called.

@yukimochi
Copy link
Contributor Author

I thought too server actor may best way to solve problem, but that may need more time to implement.
Now non Mastodon ActivityPub implement may misread "who report" "who follow relay" is large problem, this is mitigation measures.

@Gargron Gargron merged commit fae3263 into mastodon:master Jan 5, 2019
@yukimochi yukimochi deleted the use-contact-username branch January 5, 2019 07:49
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
* Use Contact User as Relay, Report, Subscribe.

* Use Account.representative to fetch contact user.

* Use find_local.

* No reason to use Account.representative in subscribe_service.

* Don't required representative!

* Fallback is included in Account.representative method.
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.

4 participants