app/controllers/github_bot/application_controller.rb
# Public: Returns <true> if the incoming request if properly authorized
Returns  if the incoming request if properly authorized
Returns if the incoming request if properly authorized
def valid_request?
      signature = github_signature
      my_signature = 'sha1=' + OpenSSL::HMAC.hexdigest(
        OpenSSL::Digest.new('sha1'),
        ENV['GITHUB_WEBHOOK_SECRET'],
        github_payload_raw
      )
      json_response(json_access_denied, :unauthorized) unless Rack::Utils.secure_compare(my_signature, signature)
    rescue StandardError => e
      msg = "#{self.class}##{__method__} An error occurred while determine if request is valid"
      Rails.logger.error(
        message: msg,
        exception: e
      )
      json_response(json_access_denied(errors: { message: "#{msg}, exception: #{e.message}" }), :unauthorized)
    end
def valid_request? signature = github_signature my_signature = 'sha1=' + OpenSSL :: HMAC . hexdigest ( OpenSSL :: Digest . new ( 'sha1' ) , ENV [ 'GITHUB_WEBHOOK_SECRET' ] , github_payload_raw ) json_response ( json_access_denied , :unauthorized ) unless Rack :: Utils . secure_compare ( my_signature , signature ) rescue StandardError => e msg = "#{self.class}##{__method__} An error occurred while determine if request is valid" Rails . logger . error ( message : msg , exception : e ) json_response ( json_access_denied ( errors : { message : "#{msg}, exception: #{e.message}" } ) , :unauthorized ) end
Public: Returns <true> if the incoming request if properly authorized
Public : Returns <true > if the incoming request if properly authorized