nyastodon/spec/controllers
Eugen Rochko 21ad21cb50
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 a00ce8c92c.

* 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 00:15:55 +02:00
..
activitypub Use raw status code on have_http_status (#7214) 2018-04-21 21:35:07 +02:00
admin lint pass 2 (#8878) 2018-10-04 17:38:04 +02:00
api rubocop issues - Cleaning up (#8912) 2018-10-08 04:50:11 +02:00
auth Lint pass (#8876) 2018-10-04 12:36:53 +02:00
concerns Improve signature verification safeguards (#8959) 2018-10-12 00:15:55 +02:00
oauth Add force_login option to OAuth authorize page (#8655) 2018-09-09 04:10:44 +02:00
settings lint pass 2 (#8878) 2018-10-04 17:38:04 +02:00
well_known Serialize webfinger XML with Ox instead of Nokogiri (#7319) 2018-05-02 22:28:46 +02:00
about_controller_spec.rb Compensate for scrollbar disappearing when media modal visible (#8100) 2018-07-31 01:14:33 +02:00
account_follow_controller_spec.rb Cover AccountFollowController more in spec (#3227) 2017-05-22 16:29:48 +02:00
account_unfollow_controller_spec.rb Cover AccountUnfollowController more in spec (#3228) 2017-05-22 17:58:49 +02:00
accounts_controller_spec.rb Lint pass (#8876) 2018-10-04 12:36:53 +02:00
application_controller_spec.rb Lint pass (#8876) 2018-10-04 12:36:53 +02:00
authorize_interactions_controller_spec.rb Add remote interaction dialog for toots (#8202) 2018-08-18 03:03:12 +02:00
emojis_controller_spec.rb Misc. typos (#8694) 2018-09-14 00:53:09 +02:00
follower_accounts_controller_spec.rb Add tests for followers_accounts_controller (#7794) 2018-06-13 10:28:39 +09:00
following_accounts_controller_spec.rb Add tests for following accounts controller (#7800) 2018-06-14 10:49:17 +09:00
home_controller_spec.rb Redirect from Web tag timeline to public tag timeline if not signed in (#6633) 2018-03-05 19:29:36 +01:00
intents_controller_spec.rb Add remote interaction dialog for toots (#8202) 2018-08-18 03:03:12 +02:00
invites_controller_spec.rb Lint pass (#8876) 2018-10-04 12:36:53 +02:00
manifests_controller_spec.rb Use raw status code on have_http_status (#7214) 2018-04-21 21:35:07 +02:00
media_controller_spec.rb Use raw status code on have_http_status (#7214) 2018-04-21 21:35:07 +02:00
remote_follow_controller_spec.rb Use raw status code on have_http_status (#7214) 2018-04-21 21:35:07 +02:00
remote_unfollows_controller_spec.rb Lint pass (#8876) 2018-10-04 12:36:53 +02:00
shares_controller_spec.rb Add tests for shares_controller (#7835) 2018-06-18 10:45:20 +09:00
statuses_controller_spec.rb Paginate descendant statuses in public page (#7148) 2018-04-23 19:27:35 +02:00
stream_entries_controller_spec.rb Misc. typos (#8694) 2018-09-14 00:53:09 +02:00
tags_controller_spec.rb Use raw status code on have_http_status (#7214) 2018-04-21 21:35:07 +02:00