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

Merge upstream changes #1158

Merged

Conversation

ClearlyClaire
Copy link

@ClearlyClaire ClearlyClaire commented Jul 14, 2019

A lot of upstream changes, the most disruptive being:

  • Dropped support for OStatus and Atom feeds
  • Added an anti-spam feature that auto-silences and auto-report remote accounts posting very similar (according to the Nilsimsa Hash algorithm) unsolicited (as in, mentioning at least one local user who do not follow them, and not in reply to a message mentioning them) messages. It is currently not optional. It can be disabled from the admin settings.
  • Started signing every fetch with the representative account (that is, the contact account if it is defined, the first non-suspended local account in the database otherwise) a dedicated instance actor
  • Added an option to disable reverse proxy caches and only serve toots if there is a valid signature (it is unadvisable to enable that option right now, as no Mastodon release currently signs queries)

Gargron and others added 30 commits July 6, 2019 23:26
* Remove Salmon and PubSubHubbub endpoints

* Add error when trying to follow OStatus accounts

* Fix new accounts not being created in ResolveAccountService
* Disable incorrect check for hidden services in Socket

Hidden services can only be accessed with an HTTP proxy, in which
case the host seen by the Socket class will be the proxy, not the
target host.

Hidden services are already filtered in `Request#initialize`.

* Use our Socket class to connect to HTTP proxies

Avoid the timeout logic being bypassed

* Add support for IP addresses in Request::Socket

* Refactor a bit, no need to keep the DNS resolver around
)

* Fix BackupService crashing when an attachment is missing

For various reasons such as admin error or out-of-sync media and
database backups, it might be possible for local attachments to be lost.

This commit allows the BackupService to continue its work even if some media
file is missing.

* Change error message
…todon#11254)

Bumps [@babel/plugin-proposal-class-properties](https://github.com/babel/babel) from 7.4.4 to 7.5.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](babel/babel@v7.4.4...v7.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Bumps [tzinfo-data](https://github.com/tzinfo/tzinfo-data) from 1.2019.1 to 1.2019.2.
- [Release notes](https://github.com/tzinfo/tzinfo-data/releases)
- [Commits](tzinfo/tzinfo-data@v1.2019.1...v1.2019.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.13. **This update includes security fixes.**
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.11...4.17.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
* Add HTTP signature requirement for served ActivityPub resources

* Change `SECURE_MODE` to `AUTHORIZED_FETCH`

* Add 'Signature' to 'Vary' header and improve code style

* Improve code style by adding `public_fetch_mode?` method
)

- Change the maximum count of retry for web push notification (Default -> 5).
   - In case of high load of subscribe server, the retries will be repeated many times.
   - Because the retries occupy the default queue, maximum retry count should be reduced.
* Add a spam check

* Use Nilsimsa to generate locality-sensitive hashes and compare using Levenshtein distance

* Add more tests

* Add exemption when the message is a reply to something that mentions the sender

* Use Nilsimsa Compare Value instead of Levenshtein distance

* Use MD5 for messages shorter than 10 characters

* Add message to automated report, do not add non-public statuses to
automated report, add trust level to accounts and make unsilencing
raise the trust level to prevent repeated spam checks on that account

* Expire spam check data after 3 months

* Add support for local statuses, reduce expiration to 1 week, always create a report

* Add content warnings to the spam check and exempt empty statuses

* Change Nilsimsa threshold to 95 and make sure removed statuses are removed from the spam check

* Add all matched statuses into automatic report
@cwebber
Copy link

cwebber commented Jul 17, 2019

@cwebber The "who is calling me" approach you are describing is the basis of all API authentication (API keys) as well as all website logins (username/password, session cookie) in the world. I am very confused why you think this is different. We've been authenticating inbox deliveries using this approach since the start of ActivityPub.

There's the source of misunderstanding: I'm saying that "who is calling me" is a broken model. "Who said this thing" is another thing entirely; that's verifying the authenticity of messages. Authentication != authorization, though I know that prevailing paradigms conflate the two. You can see oauth bearer tokens, for instance, as authority without authentication (even if authentication was used to obtain them, and it isn't always).

That's the problem: a move from authentication to verify who is saying things to authentication as a form of authorization. I know it isn't obvious that this is a risk, and while there is academic'ish literature out there that explains it, I need to distill what risks we are facing here for an AP-implementor audience (we've done a bit more to explain the general concepts in this episode of Libre Lounge but it isn't "targeted" at the risks to moving to this model for authorization on the fediverse specifically).

Anyway, I'm off to write.

EDIT: Another source of confusion is that the words "authorization" and "authentication" sound so damn similar in english, leaving me to even mix up the two while trying to explain things in this post. Fixed.

Gargron and others added 18 commits July 17, 2019 19:29
* Add environment variable to disable the anti-spam

* Move antispam setting to admin settings

* Fix typo

* antispam → spam_check
* Add support for an instance actor

* Skip username validation for local Application accounts

* Add migration script to create instance actor

* Make Codeclimate happy

* Switch to id -99 for instance actor

* Remove unused `icon` and `image` attributes from instance actor

* Use if/elsif/else instead of return + ternary operator

* Add instance actor to fresh installs

* Use instance actor as instance representative

Use instance actor for forwarding reports, relay operations, and spam
auto-reporting.

* Seed database in test environment

* Fix single-user mode

* Fix tests

* Fix specs to accomodate for an extra `Account`

* Auto-reject follows on instance actor

Following an instance actor might make sense, but we are not handling that
right now, so auto-reject.

* Fix webfinger lookup and serialization for instance actor

* Rename instance actor

* Make it clear in the HTML view that the instance actor should not be blocked

* Raise cache time for instance actor as there's no dynamic content

* Re-use /about/more with a flash message for instance actor profile
* Add test

* Fix code for sanitizing nested lists stripping all tags
* Added logout to dropdown menu

* Triggering build-and-test with empty commit as it seems it failed due to some internal failure

* Looks fine, ready to review

* Added changes from review

* method can be null without any problems

* Also target can be null
Conflicts:
- Gemfile.lock
- app/controllers/accounts_controller.rb
- app/controllers/admin/dashboard_controller.rb
- app/controllers/follower_accounts_controller.rb
- app/controllers/following_accounts_controller.rb
- app/controllers/remote_follow_controller.rb
- app/controllers/stream_entries_controller.rb
- app/controllers/tags_controller.rb
- app/javascript/packs/public.js
- app/lib/sanitize_config.rb
- app/models/account.rb
- app/models/form/admin_settings.rb
- app/models/media_attachment.rb
- app/models/stream_entry.rb
- app/models/user.rb
- app/serializers/initial_state_serializer.rb
- app/services/batched_remove_status_service.rb
- app/services/post_status_service.rb
- app/services/process_mentions_service.rb
- app/services/reblog_service.rb
- app/services/remove_status_service.rb
- app/views/admin/settings/edit.html.haml
- config/locales/simple_form.pl.yml
- config/settings.yml
- docker-compose.yml
…/:id`

Port SCSS changes from b851456 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
@ClearlyClaire
Copy link
Author

Upstream now signs fetch requests with a dedicated actor not representing an user in particular, and the anti-spam can be disabled from the admin interface.

Therefore, I am ready to merge this into glitch-soc.

The code for requiring authentication for fetches is here and can be enabled, but its use is not encouraged nor documented. I don't think having it in changes anything wrt. our ability to switch to an ocap-based approach when that starts being sufficiently well specified.

@ClearlyClaire ClearlyClaire merged commit f1597e1 into glitch-soc:master Jul 20, 2019
atsu1125 pushed a commit to atsu1125/mastodon that referenced this pull request Sep 19, 2022
We were rendering an escaped version of the SVG in this template where we should have been rendering the SVG itself.

Fixes glitch-soc#1158.
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.