Browse Source

Do not sign useless User-Agent or Accept-Encoding headers (#8533)

Fix #8080
pull/4/head
Eugen Rochko 5 years ago
committed by GitHub
parent
commit
e3764bdb52
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      app/lib/request.rb

+ 3
- 3
app/lib/request.rb View File

@ -73,15 +73,15 @@ class Request
algorithm = 'rsa-sha256'
signature = Base64.strict_encode64(@keypair.sign(OpenSSL::Digest::SHA256.new, signed_string))
"keyId=\"#{key_id}\",algorithm=\"#{algorithm}\",headers=\"#{signed_headers}\",signature=\"#{signature}\""
"keyId=\"#{key_id}\",algorithm=\"#{algorithm}\",headers=\"#{signed_headers.keys.join(' ').downcase}\",signature=\"#{signature}\""
end
def signed_string
@headers.map { |key, value| "#{key.downcase}: #{value}" }.join("\n")
signed_headers.map { |key, value| "#{key.downcase}: #{value}" }.join("\n")
end
def signed_headers
@headers.keys.join(' ').downcase
@headers.without('User-Agent', 'Accept-Encoding')
end
def key_id

Loading…
Cancel
Save