gabrielg / mail_to_hip_chat

Funnels email into HipChat
Other
18 stars 2 forks source link

400 response from airbrake #3

Open biemedia opened 12 years ago

biemedia commented 12 years ago

Airbrake errors are throwing a 400 error in mail_to_hip_chat.

The test email works perfectly.

gabrielg commented 12 years ago

Thanks for letting me know. I'll take a look.

biemedia commented 12 years ago

I just tried killing the entire valid response block and then I get a 404 if that helps at all.

gabrielg commented 12 years ago

So, I'm not working somewhere using HipChat now. So it's a little more work to take a look at this. Sorry to leave the issue open so long. Were you able to get any further with it?

jm3 commented 9 years ago

Getting the same problem. I realize it's an old issue, but maybe if you could spare a minute to take a look, it would be something easy to fix? I'm not really sure how to debug that endpoint on localhost.

jm3 commented 9 years ago

this is also happening for the test email; CloudMailIn rejects the message because the app's /notifications/create endpoint returns 400 which seems to be because valid_request isn't returning true

gabrielg commented 9 years ago

Hey! Thanks for opening the issues. The problem is I haven't used HipChat since 2011, and I don't have the time right now to sign up for it and Mailgun and figure out what's going on. I'm happy to help in whatever other way I can.

To debug the endpoint on localhost you can use something like NGrok or an SSH reverse tunnel. If you get it fixed and submit a PR I can add you as a collaborator on the project and give you access to publish the gem.

jm3 commented 9 years ago

wow, ngrok is way cool! thanks for turning me onto this. if I figure it out, I'll submit a PR

jm3 commented 9 years ago

so i tracked it down: line 20 of rack_app#call dies because of an invalid request (signature doesn't match) — create_sig_from_params is generating a signature that doesn't match the request's signature. (the actual differing hash values are: c1e351c415058a9f3e801dd700e7f316 vs 2bf3e0e8f2e805a779151e41661da8f4)

what would i investigate to see why that is?

Byebug trace:

(rdb:4) pp param_vals_with_secret
"",
 "xxx@140proof.com",
 "mail-qg0-f41.google.com",
 "html-guts",
 "mail-message-guts-here",
 "CABhhQHQnqee4EvEpUyAohjQX-9oK_9oHcTqVEqp=o06um8nyJQ@mail.gmail.com",
 "5\n",
 "[\"1b7adeadbeeff503a7c@cloudmailin.net\"]",
 "",
 {"result"=>"neutral", "domain"=>"140proof.com"},
 "testing setup",
 "<1b7adeadbeeff503a7c@cloudmailin.net>",
 "",
 "[\"xxx@140proof.com\"]",
 "111.11.111.11",
 "[\"1b7adeadbeeff503a7c@cloudmailin.net\"]"]

(rdb:4) p Digest::MD5.hexdigest(param_vals_with_secret.join)
"c1e351c415058a9f3e801dd700e7f316"

(rdb:4) p request.params[SIGNATURE_PARAM_NAME]
"2bf3e0e8f2e805a779151e41661da8f4"

(rdb:4) pp @params
{"to"=>"<1b7adeadbeeff503a7c@cloudmailin.net>",
 "disposable"=>"",
 "from"=>"xxx@140proof.com",
 "subject"=>"testing setup",
 "message"=>  "MIME-shit",
 "plain"=>"5\n",
 "html"=>  "HTML-shit\n",
 "reply_plain"=>"",
 "mid"=>"CABhhQHQnqee4EvEpUyAohjQX-9oK_9oHcTqVEqp=o06um8nyJQ@mail.gmail.com",
 "x_to_header"=>"[\"1b7adeadbeeff503a7c@cloudmailin.net\"]",
 "x_from_header"=>"[\"xxx@140proof.com\"]",
 "x_cc_header"=>"",
 "x_remote_ip"=>"111.111.11.11",
 "helo_domain"=>"mail-qg0-f41.google.com",
 "recipients"=>"[\"1b7adeadbeeff503a7c@cloudmailin.net\"]",
 "spf"=>{"result"=>"neutral", "domain"=>"140proof.com"},
 "signature"=>"2bf3e0e8f2e805a779151e41661da8f4"}