-
Notifications
You must be signed in to change notification settings - Fork 275
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
Reinstate full protection against slow retrieval attacks #932
Comments
I'd like to grab this, though it may be a a couple of weeks until I get round to it. |
@lukpueh Hi, I don't think anyone working on this, can I pick up this issue ? |
Hello @lukpueh! I'd like to pick this up as my GSoC project. |
Thanks for your interest, @optimisticanshul and @govardhangdg! Make sure to turn in your GSoC application by the end of March. Besides, you are welcome to join us on the CNCF TUF slack channel and tell us a little bit about you and why you are interested in working on TUF and this task in particular. :) |
Thanks @lukpueh. Will do! |
Hey @lukpueh, |
Hello Everyone, Following the suggestion that @lukpueh says here, I've look around for a replacement for Properties that fit for a good candidate for
|
Many thanks for putting this together, @jcstr! Also, I wonder which of the key features you mention above you intend to use for this task. Can you explain why all of these are relevant? At any rate, I'm looking forward to seeing proof-of-concept example. How is that coming along? Any code to share? Btw., (and this is more a note to the co-maintainer) I saw that none of the mentioned libraries work on Python 2.7. @SantiagoTorres, @trishankatdatadog, @JustinCappos how long do we still want to support a Python 2.7 client? |
I think this is an artifact of async not existing on py2 (iirc). My ideal roadmap was to:
I find this appealing because we can also allow people to fall back to the default implementation if they find things to be finnicky. Needless to say, this way we can also leave py2 out of the question. |
Agreed with @SantiagoTorres approach. I wouldn't make this a blocking requirement, since slow retrieval attacks are lower priority compared to other, more serious attacks. |
No problem @lukpueh!, considering what you're saying in here I'll look closely to
As long as I'm on my way to help with this issue, I think that mention the key features of
And the reason behind of this is, according to the knowledge I'm getting of this topic is web sockets are relevant for this particular case, we're looking for a solution that help us along side timeouts, that's were Asynchronous I/O comes to help.
I need help with this, I've look around the I'm looking for a way to refactor |
🎉
Right now the TUF updater uses HTTP, which has the advantage that we don't really need to think about the server implementation. Why should we instead use the websocket protocol?
I agree with Santiago, don't worry too much about fixing the TUF updater just yet. It would be nice to see a minimal working example, where you have a server that slowly serves a file to a client if the download drops below a chosen rate. This can be a simple stand-alone example and I doesn't necessarily need to follow any sophisticated design patterns unless you want to.
|
I don't claim to be an expert on Requests but I don't see why this is true:
Can someone explain this (e.g. with an example)? The current implementation uses a fairly huge CHUNK_SIZE (400000). Are you sure a more reasonable value would not allow you to choose acceptable MIN_AVERAGE_DOWNLOAD_SPEED value (as well as Requests connect and read timeouts)? EDIT: partly answering myself with some bits from the linked bug: the concern seems to be that with whatever reasonable chunk size and read timeout the maximum download time for a single chunk would be too long. Would still be interesting to see what actual cases of slow retrieval attacks non-blocking IO will protect from... I don't see too many numbers in the linked PR either. |
I tested my assumptions a bit: I did download tests (very unscientific just to get a feel for it: laptop with many workloads, wifi with other users on it). I downloaded 100MB using a loop like the one in tuf for each chunk size ten times and picked the fastest results.
So on my laptop and wifi you can reduce CHUNK_SIZE to 100 bytes (0.025% of its current value) without affecting download speed. I'm not saying we should do that (my test starts to become CPU-bound at lower chunk sizes and there could be other disadvantages like increased network traffic because of overhead). I am saying that 400000 is a huge chunk size -- smaller values can probably be used without affecting performance. |
Linking to #1213 updater: Abstract out the network IO: it proposes creating a client network IO interface that clients can implement and providing a default implementation in TUF. Effects on this issue would be:
|
Description of issue or feature request:
#781 updated tuf's downloader module to use
requests
instead of custom networking code, to fix issues with HTTPS proxies.This change, however, deprived TUF of a way to prevent a certain kind of slow retrieval attack, where the attacker sends bytes below a minimum average speed.
This attack can not be prevented with the timeout parameters provided by
requests
, which are:Current behavior:
Cannot reliably enforce minimal average download speed and thus is vulnerable to slow retrieval attacks.
Expected behavior:
Reinstate full protection against slow retrieval attacks
Possible ways of fixing are
requests
and ask them to fix it, orrequests
-alternative that supports non-blocking I/ONote: The comments in #781 have more ways of addressing this issue and also discuss whey they are not viable. Consider reading up on the discussion when working on this issue.
The text was updated successfully, but these errors were encountered: