Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 2 files). Show all
Unified · Split
| @@ -2369,20 +2369,20 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 2368 unmodified lines | ||
| 2369 | 2369 | QList<QString> safeURLPrefixes = { "file:///", "atp:", "cache:" }; |
| 2370 | 2370 | safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); |
| 2371 | 2371 | |
| 2372 | − // ENTITY SCRIPT WHITELIST TOGGLE CHECK | |
| 2372 | + // Entity Script Whitelist toggle check. | |
| 2373 | 2373 | Setting::Handle<bool> whitelistEnabled {"private/whitelistEnabled", false }; |
| 2374 | 2374 | |
| 2375 | 2375 | if (!whitelistEnabled.get()) { |
| 2376 | 2376 | passList = true; |
| 2377 | 2377 | } |
| 2378 | 2378 | |
| 2379 | − // PULL SAFEURLS FROM INTERFACE.JSON Settings | |
| 2379 | + // Pull SAFEURLS from the Interface.JSON settings. | |
| 2380 | 2380 | QVariant raw = Setting::Handle<QVariant>("private/settingsSafeURLS").get(); |
| 2381 | 2381 | QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QString::SkipEmptyParts); |
| 2382 | 2382 | safeURLPrefixes += settingsSafeURLS; |
| 2383 | − // END PULL SAFEURLS FROM INTERFACE.JSON Settings | |
| 2383 | + // END Pull SAFEURLS from the Interface.JSON settings. | |
| 2384 | 2384 | |
| 2385 | − // GET CURRENT DOMAIN WHITELIST BYPASS, IN CASE AN ENTIRE DOMAIN IS WHITELISTED | |
| 2385 | + // Get current domain whitelist bypass, in case an entire domain is whitelisted. | |
| 2386 | 2386 | QString currentDomain = DependencyManager::get<AddressManager>()->getDomainURL().host(); |
| 2387 | 2387 | |
| 2388 | 2388 | QString domainSafeIP = nodeList->getDomainHandler().getHostname(); |
| @@ -2395,9 +2395,9 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 6 unmodified lines | ||
| 2395 | 2395 | passList = true; |
| 2396 | 2396 | } |
| 2397 | 2397 | } |
| 2398 | − // END CURRENT DOMAIN WHITELIST BYPASS | |
| 2398 | + // END bypass whitelist based on current domain. | |
| 2399 | 2399 | |
| 2400 | − // START CHECKING AGAINST THE WHITELIST | |
| 2400 | + // Start processing scripts through the whitelist. | |
| 2401 | 2401 | if (ScriptEngine::getContext() == "entity_server") { // If running on the server, do not engage whitelist. |
| 2402 | 2402 | passList = true; |
| 2403 | 2403 | } else if (!passList) { // If waved through, do not engage whitelist. |
| @@ -2407,11 +2407,11 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 3 unmodified lines | ||
| 2407 | 2407 | if (!str.isEmpty() && scriptOrURL.startsWith(str)) { |
| 2408 | 2408 | passList = true; |
| 2409 | 2409 | qCDebug(scriptengine) << whitelistPrefix << "Script approved."; |
| 2410 | − break; // bail early since we found a match | |
| 2410 | + break; // Bail early since we found a match. | |
| 2411 | 2411 | } |
| 2412 | 2412 | } |
| 2413 | 2413 | } |
| 2414 | − // END CHECKING AGAINST THE WHITELIST | |
| 2414 | + // END processing of scripts through the whitelist. | |
| 2415 | 2415 | |
| 2416 | 2416 | if (!passList) { // If the entity failed to pass for any reason, it's blocked and an error is thrown. |
| 2417 | 2417 | qCDebug(scriptengine) << whitelistPrefix << "(disabled entity script)" << entityID.toString() << scriptOrURL; |