git-hulk commented on code in PR #2765:
URL: https://github.com/apache/kvrocks/pull/2765#discussion_r1939622733


##########
src/server/redis_connection.cc:
##########
@@ -385,10 +385,17 @@ void 
Connection::ExecuteCommands(std::deque<CommandTokens> *to_process_cmds) {
 
     auto cmd_s = Server::LookupAndCreateCommand(cmd_tokens.front());
     if (!cmd_s.IsOK()) {
+      auto cmd_name = cmd_tokens.front();
+      if (util::EqualICase(cmd_name, "host:") || util::EqualICase(cmd_name, 
"post")) {
+        LOG(WARNING) << "A likely HTTP request is detected in the RESP 
connection, indicating a potential "
+                        "Cross-Protocol Scripting attack. Connection aborted.";
+        owner_->FreeConnection(this);
+        break;

Review Comment:
   I think we can `Close` the connection and return here. To prevent wrongly 
using the connection outside the while loop.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to