-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add external path and type whitelist to ResourceLoader #42
base: master
Are you sure you want to change the base?
Conversation
if (using_whitelist && !external_path_whitelist.has(path)) {
WARN_PRINT(vformat("Blocked internal resource path not in whitelist: %s.", path));
- external_resources.write[i].load_token = ResourceLoader::_load_start(path, external_resources[i].type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, ResourceFormatLoader::CACHE_MODE_REUSE, false, false, Dictionary(), Dictionary());
+ external_resources.write[i].load_token = ResourceLoader::_load_start(path, external_resources[i].type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, cache_mode_for_external, true, using_whitelist, external_path_whitelist, type_whitelist);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments left in discord
a7ac54a
to
8367132
Compare
Test failure. ./tests/scene/test_resource_loader.h:151:
TEST CASE: [SceneTree][ResourceLoader] Load Binary Resource Whitelisted - No allowed paths in the whitelist
./tests/scene/test_resource_loader.h:159: ERROR: CHECK_FALSE( resource.is_valid() ) is NOT correct!
values: CHECK_FALSE( true ) TEST_CASE("[SceneTree][ResourceLoader] Load Binary Resource Whitelisted - No allowed paths in the whitelist") {
init("load_resource_whitelisted_malicious_path", "res://");
Dictionary ext_whitelist;
Dictionary type_whitelist;
type_whitelist["GradientTexture2D"] = true;
type_whitelist["Gradient"] = true;
Ref<Texture2D> resource = ResourceLoader::load_whitelisted(
"res://trojan_resource.res", ext_whitelist, type_whitelist, "Texture2D");
CHECK_FALSE(resource.is_valid());
} |
049ff68
to
f97eace
Compare
f97eace
to
c37a447
Compare
For review.