envoyproxy / envoyproxy/envoy

Mongo filter needs update

Open
#31,810 4 comments 2 reactions 0 assignees View on GitHub
area/dependency area/mongodb help wanted no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Title*: *Mongo filter is too old: needs update*

*Description*:
The mongo wire protocol has changed a lot since version 3.6 but the mongo filter remains same. In fact, the most of the opcodes that were handled in mongo filter source code([codec source file](https://github.com/envoyproxy/envoy/blob/main/source/extensions/filters/network/mongo_proxy/codec_impl.cc#L372)) were deprecated in mongo version 5 (see details [here](https://www.mongodb.com/docs/v5.0/reference/mongodb-wire-protocol/#request-opcodes)). [OP_MSG](https://www.mongodb.com/docs/v5.0/reference/mongodb-wire-protocol/#std-label-wire-op-msg) is used instead. _OP_MSG_ (having value 2013) isn't handled in current mongo filter for which an exception log(as programmed [here](https://github.com/envoyproxy/envoy/blob/main/source/extensions/filters/network/mongo_proxy/codec_impl.cc#L425C39-L425C55))- `invalid mongo op 2013` is generated in envoy log. I've seen people complained for getting this log (e.g., #5648).
While I was testing this, I took tcpdump, I have seen that mongo 4.4.6 was using OP_MSG while I was making insert request from client though opcode like _OP_INSERT_ was deprecated in version 5.
Mongo Filter is too old that support pre-3.6 version of mongo that people no more use or very rarely do.

Relevant PRs(never merged):
#5053 :this PR could've been the savior, I feel bad that it was too close to get merged
#5198

**Update:**:
>If the node supports OP_MSG, any and all messages MUST use OP_MSG, optionally compressed with OP_COMPRESSED. Authentication messages MUST also use OP_MSG when it is supported, but MUST NOT use OP_COMPRESSED.

[Source](https://github.com/mongodb/specifications/blob/master/source/message/OP_MSG.rst#usage)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.