mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 16:13:28 +02:00
Disable whitelist on entity_server scripts.
This commit is contained in:
parent
d872e9f07d
commit
fb5dbfc52a
1 changed files with 15 additions and 9 deletions
|
@ -2377,15 +2377,21 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
// END PULL SAFEURLS FROM INTERFACE.JSON Settings
|
||||
|
||||
bool isInWhitelist = false; // assume unsafe
|
||||
for (const auto& str : safeURLS) {
|
||||
qCDebug(scriptengine) << whitelistPrefix << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN"
|
||||
<< scriptOrURL.startsWith(str);
|
||||
if (!str.isEmpty() && scriptOrURL.startsWith(str)) {
|
||||
isInWhitelist = true;
|
||||
qCDebug(scriptengine) << whitelistPrefix << "Script approved.";
|
||||
break; // bail early since we found a match
|
||||
}
|
||||
}
|
||||
|
||||
if(ScriptEngine::getContext() == "entity_server") {
|
||||
isInWhitelist = true;
|
||||
} else {
|
||||
for (const auto& str : safeURLS) {
|
||||
qCDebug(scriptengine) << whitelistPrefix << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN"
|
||||
<< scriptOrURL.startsWith(str);
|
||||
if (!str.isEmpty() && scriptOrURL.startsWith(str)) {
|
||||
isInWhitelist = true;
|
||||
qCDebug(scriptengine) << whitelistPrefix << "Script approved.";
|
||||
break; // bail early since we found a match
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isInWhitelist) {
|
||||
qCDebug(scriptengine) << whitelistPrefix << "(disabled entity script)" << entityID.toString() << scriptOrURL;
|
||||
exception = makeError("UNSAFE_ENTITY_SCRIPTS == 0");
|
||||
|
|
Loading…
Reference in a new issue