node-mitm icon indicating copy to clipboard operation
node-mitm copied to clipboard

gRPC • http/2 - calls do not work with bypass

Open pabloalmeidas13 opened this issue 4 years ago • 2 comments

Good afternoon, first I found this library incredible, congratulations on the work!

I use lib to intercept various protocols (http, https, mongodb, rabbitmq, redis, etc. ..) however, when I try to intercept the gRPC calls made by lib Google PubSub it doesn't work like the other protocols, it seems to be looping.

investigating on the internet, i found that this lib uses under the engine called gRPC, and that in turn uses underneath called http2

Our use case is not for the purpose of TDD (unit tests), but I use it as a Firewall allowing or not requests.

Below is an example of my code:

` var Mitm = require("mitm"); var mitm = Mitm(); mitm.enable();

    mitm.on("connect", function(socket:any, opts:any) {
        socket.bypass();
        try{         
            if("my release rule") {
                socket.bypass();
            }
            else {
                socket.end();
            }
        }
        catch(err){
            socket.end();
        }
    });

`

Nodejs : v12.16.1

pabloalmeidas13 avatar Mar 19 '21 20:03 pabloalmeidas13

Hey!

Thanks for the heads-up! Yeah, it probably indeed doesn't work with HTTP/2 yet. I should take a look how that's implemented in Node.js.

moll avatar May 01 '21 16:05 moll

Tanks @moll, i'm looking forward it 👍 🚀

pabloalmeidas13 avatar May 03 '21 15:05 pabloalmeidas13