mastodon/app/controllers
Eugen Rochko 27376e2457 Improve signature verification safeguards (#8959)
* Downcase signed_headers string before building the signed string

The HTTP Signatures draft does not mandate the “headers” field to be downcased,
but mandates the header field names to be downcased in the signed string, which
means that prior to this patch, Mastodon could fail to process signatures from
some compliant clients. It also means that it would not actually check the
Digest of non-compliant clients that wouldn't use a lowercased Digest field
name.

Thankfully, I don't know of any such client.

* Revert "Remove dead code (#8919)"

This reverts commit 65d1a2d10a.

* Restore time window checking, change it to 12 hours

By checking the Date header, we can prevent replaying old vulnerable
signatures. The focus is to prevent replaying old vulnerable requests
from software that has been fixed in the meantime, so a somewhat long
window should be fine and accounts for timezone misconfiguration.

* Escape users' URLs when formatting them

Fixes possible HTML injection

* Escape all string interpolations in Formatter class

Slightly improve performance by reducing class allocations
from repeated Formatter#encode calls

* Fix code style issues
2018-10-12 07:00:41 +02:00
..
activitypub Better pagination for ActivityPub outbox (#7356) 2018-05-04 19:19:11 +02:00
admin Merge branch 'master' into glitch-soc/merge-upstream 2018-10-08 13:51:33 +02:00
api Merge branch 'master' into glitch-soc/merge-upstream 2018-10-08 13:51:33 +02:00
auth Merge branch 'master' into glitch-soc/merge-upstream 2018-09-19 21:46:01 +02:00
concerns Improve signature verification safeguards (#8959) 2018-10-12 07:00:41 +02:00
oauth Merge branch 'master' into glitch-soc/merge-upstream 2018-09-11 16:51:26 +02:00
settings Merge branch 'master' into glitch-soc/merge-upstream 2018-10-01 12:43:20 +02:00
well_known Make host_meta/webfinger replies cacheable (fixes #6100) (#6101) 2017-12-27 18:21:12 +01:00
about_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-10 16:22:31 +02:00
account_follow_controller.rb Restful refactor of accounts/ routes (#2133) 2017-04-19 13:52:37 +02:00
account_unfollow_controller.rb Restful refactor of accounts/ routes (#2133) 2017-04-19 13:52:37 +02:00
accounts_controller.rb Merge branch 'master' into glitch-soc/master 2018-08-21 18:24:48 +02:00
application_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-09-11 16:51:26 +02:00
authorize_interactions_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-18 18:04:49 +02:00
custom_css_controller.rb Add admin custom CSS setting (#8399) 2018-08-24 04:33:27 +02:00
emojis_controller.rb Unuse ActiveRecord::Base#cache_key (#8185) 2018-08-19 15:52:38 +02:00
filters_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-07-12 19:26:20 +02:00
follower_accounts_controller.rb Merge remote-tracking branch 'origin/master' into merge-upstream 2018-05-18 08:47:10 -05:00
following_accounts_controller.rb Merge remote-tracking branch 'origin/master' into merge-upstream 2018-05-18 08:47:10 -05:00
home_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-11 15:45:42 +02:00
intents_controller.rb Add remote interaction dialog for toots (#8202) 2018-08-18 03:03:12 +02:00
invites_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-01 00:18:13 +02:00
manifests_controller.rb Make Chrome splash screen same color as web UI's background color (#5169) 2017-10-02 01:23:32 +02:00
media_controller.rb Save video metadata and improve video OpenGraph tags (#6481) 2018-02-16 07:22:20 +01:00
media_proxy_controller.rb Raise Mastodon::RaceConditionError if Redis lock failed (#7511) 2018-05-16 12:29:45 +02:00
remote_follow_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-18 18:04:49 +02:00
remote_interaction_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-18 18:04:49 +02:00
remote_unfollows_controller.rb Add tests for remote_unfollows_controller (#7879) 2018-06-24 19:55:55 +09:00
shares_controller.rb Merge branch 'master' into glitch-soc/merge 2018-05-11 18:12:42 +02:00
statuses_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-31 19:10:57 +02:00
stream_entries_controller.rb Merge remote-tracking branch 'origin/master' into gs-master 2018-05-03 17:23:44 -05:00
tags_controller.rb Merge branch 'master' into glitch-soc/merge-upstream 2018-08-01 00:18:13 +02:00