Skip to content
Snippets Groups Projects
Commit 363ee42d authored by Lynx Linden's avatar Lynx Linden
Browse files

EXT-3234: Display notification when SLurl blocked/throttled.

We block or throttled certain SLurls when they came from an untrusted
browser. Previously this would happen silently (though a message was
sent to the logfile). Now we show a once-per-session notification if
either of these situations arise.
parent 2c0cea90
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llcommandhandler.h" #include "llcommandhandler.h"
#include "llnotificationsutil.h"
// system includes // system includes
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
...@@ -93,6 +94,8 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, ...@@ -93,6 +94,8 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
LLMediaCtrl* web, LLMediaCtrl* web,
bool trusted_browser) bool trusted_browser)
{ {
static bool slurl_blocked = false;
static bool slurl_throttled = false;
static F64 last_throttle_time = 0.0; static F64 last_throttle_time = 0.0;
F64 cur_time = 0.0; F64 cur_time = 0.0;
std::map<std::string, LLCommandHandlerInfo>::iterator it = mMap.find(cmd); std::map<std::string, LLCommandHandlerInfo>::iterator it = mMap.find(cmd);
...@@ -110,6 +113,11 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, ...@@ -110,6 +113,11 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
// block request from external browser, but report as // block request from external browser, but report as
// "handled" because it was well formatted. // "handled" because it was well formatted.
LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL; LL_WARNS_ONCE("SLURL") << "Blocked SLURL command from untrusted browser" << LL_ENDL;
if (! slurl_blocked)
{
LLNotificationsUtil::add("BlockedSLURL");
slurl_blocked = true;
}
return true; return true;
case LLCommandHandler::UNTRUSTED_THROTTLE: case LLCommandHandler::UNTRUSTED_THROTTLE:
...@@ -119,6 +127,11 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd, ...@@ -119,6 +127,11 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
// block request from external browser if it happened // block request from external browser if it happened
// within THROTTLE_PERIOD secs of the last command // within THROTTLE_PERIOD secs of the last command
LL_WARNS_ONCE("SLURL") << "Throttled SLURL command from untrusted browser" << LL_ENDL; LL_WARNS_ONCE("SLURL") << "Throttled SLURL command from untrusted browser" << LL_ENDL;
if (! slurl_throttled)
{
LLNotificationsUtil::add("ThrottledSLURL");
slurl_throttled = true;
}
return true; return true;
} }
last_throttle_time = cur_time; last_throttle_time = cur_time;
......
...@@ -5754,6 +5754,23 @@ You just entered a region using a different server version, which may affect per ...@@ -5754,6 +5754,23 @@ You just entered a region using a different server version, which may affect per
The SLurl you clicked on is not supported. The SLurl you clicked on is not supported.
</notification> </notification>
<notification
icon="notifytip.tga"
name="BlockedSLURL"
priority="high"
type="notifytip">
A SLurl was received from an untrusted browser and has been blocked for your security.
</notification>
<notification
icon="notifytip.tga"
name="ThrottledSLURL"
priority="high"
type="notifytip">
Multiple SLurls were received from an untrusted browser within a short period.
They will be blocked for a few seconds for your security.
</notification>
<notification name="IMToast" type="notifytoast"> <notification name="IMToast" type="notifytoast">
[MESSAGE] [MESSAGE]
<form name="form"> <form name="form">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment