You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
enforce ServerOptions.auth for redis, mongo and rtmp requests - #3598
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:
Please make sure your changes are compilable.
When providing us with a new feature, it is best to add related tests.
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: