Browse Source

Fix crash on receiving requests with missing Digest header (#15782)

* Fix crash on receiving requests with missing Digest header

Return an error pointing out that Digest is missing, instead of crashing.

Fixes #15743

* Fix from review feedback
closed-social-v3
Claire 3 years ago
committed by GitHub
parent
commit
75189af528
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      app/controllers/concerns/signature_verification.rb

+ 1
- 0
app/controllers/concerns/signature_verification.rb View File

@ -133,6 +133,7 @@ module SignatureVerification
def verify_body_digest!
return unless signed_headers.include?('digest')
raise SignatureVerificationError, 'Digest header missing' unless request.headers.key?('Digest')
digests = request.headers['Digest'].split(',').map { |digest| digest.split('=', 2) }.map { |key, value| [key.downcase, value] }
sha256 = digests.assoc('sha-256')

Loading…
Cancel
Save