-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Core: Add allow_objects
/full_objects
parameter to text serialization
#80585
base: master
Are you sure you want to change the base?
Core: Add allow_objects
/full_objects
parameter to text serialization
#80585
Conversation
I do think this is worth breaking compatibility for, at least in 4.2 and maybe 3.6. I don't have any statistics, but I doubt many users are deserializing objects intentionally, and even if they are it will be a simple fix to get it working again. If possible, though, it might be useful to have an error message when not parsing an object, telling you it was skipped for security reasons and how to fix it if you want to. I'd add one for binary deserialization too if there's not one already. |
cec3096
to
a8ea7b8
Compare
a8ea7b8
to
17c909b
Compare
I skipped most of the editor's |
17c909b
to
2d6c256
Compare
Can |
|
Thanks, I found 2 matches for godot/editor/import/resource_importer_scene.cpp Line 1623 in 5444afa
godot/editor/import/resource_importer_scene.cpp Line 1701 in 5444afa
|
2d6c256
to
43c360c
Compare
43c360c
to
13913d5
Compare
13913d5
to
54a9f41
Compare
54a9f41
to
2ad51c5
Compare
0f5762a
to
9695a11
Compare
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.
Looks correct to me, didn't verify all the possible places it's used but the logic behind it makes sense, no specific remarks on the docs (Mickeon seems to have it under control!)
9695a11
to
377ff79
Compare
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.
Really great work 🚀 , the code looks good, and I've tested it with a few projects with no issues.
I was thinking that maybe API-wise having a Config.allow_object_decoding
property would be simpler (like we do in SceneMultiplayer), but I'm not sure it's better than being explicit in the methods parameter (which is maybe less surprising to the users).
While I am not against this change, this PR should not change absolutely anything by default. |
I thought about this, but there is a question about what should happen when the property changes Also, should The current implementation is more clear on these issues, since |
To clarify, this is not a real security risk in any way for existing code, so nothing needs to change. |
Let me clarify further why this is a bad idea. There are two types of security at play here:
The problem is that, if you are doing something where security really matters (example, an online or multiplayer game) you can only trust the first, never the second. If you trust the second, then all you are doing is providing a more skilled attacker with a larger surface area to exploit the first point. This is why, on the Godot side, the only real security measures are when handling marshalls, protcols and binary files. Everything else, the attack surface is too large to protect for real against a skilled attacker. Installing features like this where it seems like you are having the illusion of security, when in reality you are having none is just bad from my point of view. As example, binary configuration files are far safer than text configuration files, because the surface of attack is much smaller. You may feel this is not the case and that text configuration files are safer because you can see them, but at the same time you are afraid of scripts embedded in them that people may not see? This just makes no sense honestly, think about it for a second. So, ultimately, I think its ok if we add only a change to var_to_str and str_to_var, but then nothing else in the engine should change, because this will simply give users a false sense of security. Instead, I think we should discuss security guidelines in the documentation so users understand what APIs can they really trust and why in each situation. |
Alright, after discussions in the #core channel in rocketchat, the following was decided:
So I guess this PR is dependant on this, and it will need to be moved to at least 4.x, as I doubt everything will happen in the current time-frame. |
This PR adds the
allow_objects
/full_objects
parameter to theVariantParser
/VariantWriter
internal API that is used for thestr_to_var()
/var_to_str()
functions andConfigFile
methods.I think security reason enough to break compatibility in this case. Let me know if you think compatibility is more important and we should provide users with an insecure API by default, even if it's inconsistent with binary serialization.
str_to_var
andConfigFile
deserialize Objects is likely to cause security issues #80562Production edit: closes godotengine/godot-roadmap#69