Git Product home page Git Product logo

Comments (9)

omarkj avatar omarkj commented on June 14, 2024

I have a fix for it that carries the BUFFER_MAX size. Maybe that's too small.

I believe we might have a similar bug when reading headers: https://github.com/heroku/vegur/blob/master/src/vegur_client.erl#L388-L455 We should limit impose a limit on each pair.

from vegur.

archaelus avatar archaelus commented on June 14, 2024

Good catch!

from vegur.

ferd avatar ferd commented on June 14, 2024

A protection similar to what is enabled by this is what we'd probably need there, with a large value to prevent breaking anything.

from vegur.

omarkj avatar omarkj commented on June 14, 2024

Yeah. I did a small test that enforced the same limit but had a number of tests failing and decided to wait with it until the vegur_logging branch gets merged.

from vegur.

omarkj avatar omarkj commented on June 14, 2024

@ferd I looked into Pull Request #37 and it does not protect us agains a bad dyno sending a single header pair that might blow our memory usage. Since we split on \r\n I could send a header of the following format:

HeaderKeyThatGoesOnForever

or

HeaderKey: InfinityLongString

and we would buffer it.

from vegur.

ferd avatar ferd commented on June 14, 2024

Good point. Further protection needs to be added there. The one I've added for cookies turns out to only block out possibly fair usage that would have killed the requests coming back into our system.

That should possibly be checked at https://github.com/heroku/vegur/blob/88890bb7dab96157d9b09bf6538275b2d5a35c4e/src/vegur_client.erl#L455-461 or maybe at the top of the loop itself, and we'll need to add tests. I'll try to do something about it this morning while I wait for reviews of benchmarks.

from vegur.

ferd avatar ferd commented on June 14, 2024

Limits put from the dyno in current stack:

  • header name length: 1000 characters
  • total header size/value size: >1MB, I hit gateway timeouts before 502s.

For this reason, I'm thinking we should set a large header value possible (512kb so we break nothing), keep the 1000 header length, and enforce an artificially low value for cookie values themselves to prevent DoS.

from vegur.

omarkj avatar omarkj commented on June 14, 2024

+1 on that design.

from vegur.

ferd avatar ferd commented on June 14, 2024

Handled in pull req #40

from vegur.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.