Skip to content

enforce ServerOptions.auth for redis, mongo and rtmp requests - #3598

Merged
chenBright merged 1 commit into
apache:masterfrom
ubeddulla:redis-mongo-rtmp-auth
Oct 18, 2026
Merged

chenBright merged 1 commit into
apache:masterfrom
ubeddulla:redis-mongo-rtmp-auth

Conversation

@ubeddulla

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve

Problem Summary:

InputMessenger only authenticates a connection when the protocol registers a verify hook, but redis, mongo and rtmp register none, and redis and rtmp even consume requests inside their parsers where the hook can never run. A server configured with ServerOptions.auth still executes commands from clients that never authenticated, as long as they speak one of these three protocols. nshead, thrift and streaming RPC already fail closed in the same situation.

What is changed and the side effects?

Changed:

ParseRedisMessage and ParseRtmpMessage reject input from unauthenticated sockets when the server has an authenticator configured, the same check ParseStreamingMessage got in #3481. mongo goes through the normal message path, so it registers a VerifyMongoRequest shaped like VerifyNsheadRequest and VerifyThriftRequest. Regression tests added for all three protocols; each fails before this change (for example the unauthenticated redis command was executed and answered).

Side effects:

  • Performance effects: one pointer check per request on these paths, nothing when auth is unset.

  • Breaking backward compatibility: a server that sets ServerOptions.auth and also enables redis_service, mongo_service_adaptor or rtmp_service previously served those clients without any authentication and now rejects them, matching the documented contract of ServerOptions.auth. Redis command-level AUTH implemented via RedisCommandHandler does not rely on ServerOptions.auth and keeps working.


Check List:

@wwbmmm
wwbmmm requested a balanced review from Copilot October 12, 2026 09:08