Omnifilter: do not allow chat replacement for agent chat to prevent forgery attempts.

master
Zi Ree 2025-12-15 19:35:35 +01:00
parent d8b55a527c
commit b52e8115b5
3 changed files with 21 additions and 5 deletions

View File

@ -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);
}
}
// </FS:Zi>

View File

@ -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;

View File

@ -2849,6 +2849,8 @@ name="Command_360_Capture_Label">360° Snapshot</string>
<string name="Command_Beacons_Tooltip">Show beacons</string>
<string name="Command_Omnifilter_Tooltip">Edit the Omnifilter rules</string>
<string name="OmnifilterReplacement">Omnifilter Replacement: [REPLACEMENT]</string>
<string name="Toolbar_Bottom_Tooltip">currently in your bottom toolbar</string>
<string name="Toolbar_Left_Tooltip" >currently in your left toolbar</string>
<string name="Toolbar_Right_Tooltip" >currently in your right toolbar</string>