-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data leakage between network streams with wai/warp/http-conduit #1
Comments
It would be a good idea to include a stack.yaml file so that everyone testing this is sure to be using the same library versions. |
PR #2 adds a stack.yaml file so we can be sure we're all looking at the same thing. |
I have a theory about this issue. My suspicion is that
Not sure if this scenario is even possible. |
Funny you should mention that, I just got pinged with this: snoyberg/http-client#225 (comment) Sounds ominously familiar actually. |
Yup, this looks like the same bug I was seeing at snoyberg/http-client#225. |
Confirmed. If I edit my canal file and set |
Can you also try testing against this fix: snoyberg/http-client#226? |
Will do! I assume that'a version of http-conduit and |
Yes, that would be the idea. Though the patch in question only touch http-client, not http-conduit. |
Here's an example of how to easily test this: yesodweb/shakespeare#194 (comment) |
Doesn't seem to fix all of the issues. Here's what I did (with
With that last line I watched the cabal install and noted that I then ran |
But you need to add http-client, not http-conduit. |
I'll have to hack my code to use http-client. |
No, it's used by http-conduit On Fri, Sep 2, 2016, 1:37 PM Erik de Castro Lopo notifications@github.com
|
My test was using HTTPS, which means I should switch to http-client-tls. Has that also been fixed? |
So http-conduit uses http-client? |
Yes On Fri, Sep 2, 2016, 1:47 PM Erik de Castro Lopo notifications@github.com
|
@erikd I was able to reproduce the issue in your test case. I got
in three runs in a row. After compiling via |
Ok, I seem to have my test setup with the patched version of http-client. I don't see the
until terminated. This is due to file descriptor starvation.This did not happen with |
That sounds like a separate bug that should get opened against the On Fri, Sep 2, 2016 at 2:30 PM, Erik de Castro Lopo <
|
I had the same experience with Amazonka. Sounds pretty related |
Special vesion for debugging: erikd-ambiata/test-warp-wai#1
Data leakage has been fixed in (in think) tls. |
Hi @snoyberg,
I hope its ok to tag you like this. I'm hunting down a particularly weird bug which I currently suspect is in warp, wai or http-conduit. I've raised the issue here and tagged you because I can't figure out how to make further progress tracking it down. Although I currently think its warp, wai, http-conduit or maybe even in TLS it could also be an issue in the GHC runtime system.
The back story is that I first noticed it in one of our internal systems which has a Warp based HTTP server (via Airship) and writes data to AWS (HTTPS) using amazonka which sits on top http-conduit.
When I ran my server and ran a
wget
orcurl
request against it, I would occasionally get a packet like the following:As you can see, the response I should be getting starts at byte offset 37. The data before that is garbage, or so I thought. I spent a significant amount of time tracking it down before I figured out that if I disabled the component that uploads to AWS, the problem disappears.
I then noticed that garbage bytes that are prepended to the response is actually a TLS alert packet:
Somehow, data from the http-conduit connection to AWS (over HTTPS) is leaking into the HTTP stream. I managed to confirm this using Wireshark. I can actually capture packets that contain one or more of these TLS alert packets (complete, according to the message length field) followed by my expected HTTP response.
I've also spent many hours working on a reproducable test case I can send you. Unfortunately re-producing what I reported above (the TLS alert packet prepended to a legitimate HTTP response) was difficult and took much experimentation and tweaking. The program also shows up what may be another problem (the HTTPS
HandShakeFailed
issue), but I'm less sure of that.This repo contains the code that re-produces this problem and the
Readme.md
describes the reproduction. First of all I'm interested to see if you can reproduce it (others here in the office have reproduced the original problem on another variant of Linux and on Mac). Then I'd be interested in any advice on how to make further progress on tracking this down. Finally, I'm also interested to hear if you think that theHandshakeFailed
errors described in theReadme.md
are a bug (I actually think they are closely related to this TLS alert prepend issue).Thanks!
The text was updated successfully, but these errors were encountered: