Merge pull request #16 from rcsalvador/fix/http-signature

Add signature secret on request header

[ci skip]
pull/6827/head
Oliver Günther 6 years ago committed by GitHub
commit aaec18d2f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/workers/work_package_webhook_job.rb

@ -42,13 +42,14 @@ class WorkPackageWebhookJob < WebhookJob
def perform def perform
body = request_body body = request_body
headers = request_headers
exception = nil exception = nil
if signature = request_signature(body) if signature = request_signature(body)
request_headers['HTTP_X_OP_SIGNATURE'] = signature headers['X-OP-Signature'] = signature
end end
response = RestClient.post webhook.url, request_body, request_headers response = RestClient.post webhook.url, request_body, headers
rescue RestClient::Exception => e rescue RestClient::Exception => e
response = e.response response = e.response
@ -62,7 +63,7 @@ class WorkPackageWebhookJob < WebhookJob
webhook: webhook, webhook: webhook,
event_name: event_name, event_name: event_name,
url: webhook.url, url: webhook.url,
request_headers: request_headers, request_headers: headers,
request_body: body, request_body: body,
response_code: response.try(:code).to_i, response_code: response.try(:code).to_i,
response_headers: response.try(:headers), response_headers: response.try(:headers),

Loading…
Cancel
Save