Git Product home page Git Product logo

marcopolo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

marcopolo's Issues

Middleware is not threadsafe

Hello!

I don't use this middleware, but wanted to alert you of the issue, as thread safety defects in rack middleware can present a high security risk due to the potential risk of swapping data for concurrent requests.

In the middleware, an instance variable, @request, is set and used in the rack middleware to interact with the active request:

@request = Rack::Request.new(env)

If two or more concurrent requests are received at the same time, a server using threading rather than forking for request handling (e.g. puma), may result in the @request variable being replaced mid-request by a subsequent, concurrent request passing through the same middleware in a different thread.

Instead, use a local variable and pass the request variable to any methods that need to use it as part of handling the request. This will make the middleware threadsafe.

Capture raw HTTP log for all requests during block

It would be really useful to be able to catch the raw HTTP logs during an explicit block like so:

requests, responses = Marcopolo.capture do
      # requests to APIs
end

In this example, requests and responses would be arrays containing simplified hashes of the respective requests and responses. So requests[0]'s response would be found in responses[0].

The requests would still be logged to the marcopolo logs (if configured to do so).

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.