You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/app/controllers/concerns
ThibG b241f20bd2
Add support for latest HTTP Signatures spec draft (#14556)
* Add support for latest HTTP Signatures spec draft

https://www.ietf.org/id/draft-ietf-httpbis-message-signatures-00.html

- add support for the “hs2019” signature algorithm (assumed to be equivalent
  to RSA-SHA256, since we do not have a mechanism to specify the algorithm
  within the key metadata yet)
- add support for (created) and (expires) pseudo-headers and related
  signature parameters, when using the hs2019 signature algorithm
- adjust default “headers” parameter while being backwards-compatible with
  previous implementation
- change the acceptable time window logic from 12 hours surrounding the “date”
  header to accepting signatures created up to 1 hour in the future and
  expiring up to 1 hour in the past (but only allowing expiration dates up to
  12 hours after the creation date)
  This doesn't conform with the current draft, as it doesn't permit accounting
  for clock skew.
  This, however, should be addressed in a next version of the draft:
  https://github.com/httpwg/http-extensions/pull/1235

* Add additional signature requirements

* Rewrite signature params parsing using Parslet

* Make apparent which signature algorithm Mastodon on verification failure

Mastodon uses RSASSA-PKCS1-v1_5, which is not recommended for new applications,
and new implementers may thus unknowingly use RSASSA-PSS.

* Add workaround for PeerTube's invalid signature header

The previous parser allowed incorrect Signature headers, such as
those produced by old versions of the `http-signature` node.js package,
and seemingly used by PeerTube.

This commit adds a workaround for that.

* Fix `signature_key_id` raising an exception

Previously, parsing failures would result in `signature_key_id` being nil,
but the parser changes made that result in an exception.

This commit changes the `signature_key_id` method to return `nil` in case
of parsing failures.

* Move extra HTTP signature helper methods to private methods

* Relax (request-target) requirement to (request-target) || digest

This lets requests from Plume work without lowering security significantly.
5 years ago
..
account_controller_concern.rb Add ActivityPub secure mode (#11269) 6 years ago
account_owned_concern.rb Add whitelist mode (#11291) 6 years ago
accountable_concern.rb Add logging of admin actions (#5757) 7 years ago
authorization.rb Add moderator role and add pundit policies for admin actions (#5635) 7 years ago
cache_concern.rb Add (back) rails-level JSON caching (#11333) 6 years ago
challengable_concern.rb Add password challenge to 2FA settings, e-mail notifications (#11878) 6 years ago
export_controller_concern.rb Add account migration UI (#11846) 6 years ago
localized.rb Fix not working I18n on 2FA and Sign in token page (#14087) 5 years ago
rate_limit_headers.rb Add specific rate limits for posting and following (#13172) 5 years ago
session_tracking_concern.rb Update session activation time (fixes #5605) (#7408) 7 years ago
sign_in_token_authentication_concern.rb Fix not working I18n on 2FA and Sign in token page (#14087) 5 years ago
signature_authentication.rb Allow retrieval of private statuses (single or in outbox) using HTTP signatures (#6225) 7 years ago
signature_verification.rb Add support for latest HTTP Signatures spec draft (#14556) 5 years ago
status_controller_concern.rb Refactor controllers for statuses, accounts, and more (#11249) 6 years ago
two_factor_authentication_concern.rb Add WebAuthn as an alternative 2FA method (#14466) 5 years ago
user_tracking_concern.rb Fix #6331 (#6341) 7 years ago