From b52e8115b5ad684a1e93e289197d23211acba0bc Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Mon, 15 Dec 2025 19:35:35 +0100 Subject: [PATCH] Omnifilter: do not allow chat replacement for agent chat to prevent forgery attempts. --- indra/newview/llimprocessing.cpp | 15 ++++++++++++--- indra/newview/llviewermessage.cpp | 9 +++++++-- indra/newview/skins/default/xui/en/strings.xml | 2 ++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 9746178a62..a5809864bd 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -731,18 +731,22 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, haystack.mSenderName = agentName; haystack.mOwnerID = from_id; + bool forbid_chat_replacement = false; + switch (dialog) { case IM_NOTHING_SPECIAL: // this is the type for regular IMs { haystack.mType = OmnifilterEngine::eType::InstantMessage; + forbid_chat_replacement = true; break; } case IM_SESSION_SEND: // this is the type for regular group IMs - case IM_SESSION_INVITE: // this is the type for group IM sessions started by ourselves or conferences + case IM_SESSION_INVITE: // this is the type for new group IM sessions - see LLIMMgr::addMessage() case IM_DO_NOT_DISTURB_AUTO_RESPONSE: { haystack.mType = OmnifilterEngine::eType::GroupChat; + forbid_chat_replacement = true; break; } case IM_FROM_TASK: @@ -810,12 +814,17 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, const OmnifilterEngine::Needle* needle = OmnifilterEngine::getInstance()->match(haystack); if (needle) { - if (needle->mChatReplace.empty()) + if ( + forbid_chat_replacement // no text replacement for agent messages to prevent forgery attempts + || needle->mChatReplace.empty() // no replacement defined, just suppress the message + ) { return; } - message = needle->mChatReplace; + LLSD args; + args["REPLACEMENT"] = needle->mChatReplace; + message = LLTrans::getString("OmnifilterReplacement", args); } } // diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 83631e77d1..9b5d1f626b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3300,12 +3300,17 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) ((LLVOAvatar*)chatter)->stopTyping(); } - if (needle->mChatReplace.empty()) + if ( + chat.mSourceType == CHAT_SOURCE_AGENT // no text replacement for agent chat to prevent forgery attempts + || needle->mChatReplace.empty() // no replacement defined, just suppress the message + ) { return; } - chat.mText = needle->mChatReplace; + LLSD args; + args["REPLACEMENT"] = needle->mChatReplace; + chat.mText = LLTrans::getString("OmnifilterReplacement", args); } break; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2640f72fb5..96cdc3b3b4 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2849,6 +2849,8 @@ name="Command_360_Capture_Label">360° Snapshot Show beacons Edit the Omnifilter rules + Omnifilter Replacement: [REPLACEMENT] + currently in your bottom toolbar currently in your left toolbar currently in your right toolbar