Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2363,7 +2363,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 2362 unmodified lines | |||
| 2363 | } | 2363 | } |
| 2364 | } | 2364 | } |
| 2365 | else { | 2365 | else { |
| 2366 | // ENTITY SCRIPT WHITELIST STARTS HERE | 2366 | // ENTITY SCRIPT WHITELIST STARTS HERE |
| 2367 | QString whitelistPrefix = "[WHITELIST ENTITY SCRIPTS]"; | 2367 | QString whitelistPrefix = "[WHITELIST ENTITY SCRIPTS]"; |
| 2368 | QList<QString> safeURLS = { "" }; | 2368 | QList<QString> safeURLS = { "" }; |
| 2369 | safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); | 2369 | safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); |
| @@ -2378,16 +2378,16 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 8 unmodified lines | |||
| 2378 | 2378 | ||
| 2379 | bool isInWhitelist = false; // assume unsafe | 2379 | bool isInWhitelist = false; // assume unsafe |
| 2380 | 2380 | ||
| 2381 | if(ScriptEngine::getContext() == "entity_server") { | 2381 | if (ScriptEngine::getContext() == "entity_server") { |
| 2382 | isInWhitelist = true; | 2382 | isInWhitelist = true; |
| 2383 | } else { | 2383 | } else { |
| 2384 | for (const auto& str : safeURLS) { | 2384 | for (const auto& str : safeURLS) { |
| 2385 | qCDebug(scriptengine) << whitelistPrefix << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" | 2385 | qCDebug(scriptengine) << whitelistPrefix << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" |
| 2386 | << scriptOrURL.startsWith(str); | 2386 | << scriptOrURL.startsWith(str); |
| 2387 | if (!str.isEmpty() && scriptOrURL.startsWith(str)) { | 2387 | if (!str.isEmpty() && scriptOrURL.startsWith(str)) { |
| 2388 | isInWhitelist = true; | 2388 | isInWhitelist = true; |
| 2389 | qCDebug(scriptengine) << whitelistPrefix << "Script approved."; | 2389 | qCDebug(scriptengine) << whitelistPrefix << "Script approved."; |
| 2390 | break; // bail early since we found a match | 2390 | break; // bail early since we found a match |
| 2391 | } | 2391 | } |
| 2392 | } | 2392 | } |
| 2393 | } | 2393 | } |