Disable some unsafe CLI arguments in template builds by default.#111909
Disable some unsafe CLI arguments in template builds by default.#111909Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
315fea8 to
80df9d7
Compare
There was a problem hiding this comment.
Tested locally, it works as expected.
However, I'd make the existing arguments print an error when run, so that it doesn't fail silently like it currently does:
$ path/to/template --path ~/d/3d/truck_town/
Error: Couldn't load project data at path ".". Is the .pck file missing?
If you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).
See an example of this here:
Lines 932 to 934 in 9cd297b
Also, note that if you cd to a project folder (not a PCK), you can still run it directly with an export template binary:
$ ~/d/3d/platformer: ~/g/bin/godot.linuxbsd.template_release.x86_64
Therefore, I'm not sure the CWD handling is working correctly.
(Moving or symlinking the binary to the project folder and running it there will keep working, but I think that part is to be expected.)
|
Note that this PR will impact https://github.com/GodotModding/godot-mod-loader due to the removal of godotengine/godot-proposals#6137 could make this possible using |
There's already a way to use it without any changes (see comment in the proposal), which looks a bit hacky but should work. |
Seems like |
185db44 to
92da720
Compare
92da720 to
6f3f97e
Compare
|
Some notes: Options disabled by
Options disabled in release templates:
|
Yeah that's a legacy option, it lets you run a Godot project while in a subfolder by looking up the Let's keep it for now but deprecated (printing a warning about it), so if users rely on it in some scripts, they'll have until 4.7 to adapt their scripts, and we can drop it then. Edit: Actually scratch that, let's just drop it straight and document it in the migration guide. It's simple enough to work around when upgrading. |
Actually, it is used for a bunch (GLTF, DDS, GDScript) of unit tests (which make sense, tests are upwards of |
6f3f97e to
29da942
Compare
|
Removed |
There was a problem hiding this comment.
CWD handling seems to be working now, and a message is printed when using --path in an unsupported binary. I agree with the removal of --upwards as an exposed option, I haven't seen anyone rely on it recently.
Code looks good to me (same for the CLI help changes).
There was a problem hiding this comment.
The feature sounds good to me. If I understand it correctly, this would require users to start editing the overrides.cfg to inject mods? If yet, that would be a good indicator of improved security, while still keeping mods pretty accessible.
I've also reviewed the code. I'm only a bit familiar with the main interfaces, but from what I can judge this looks fairly straight-forward. Looks good to me anyway.
When we merge this, we should definitely document the compile options (compile and project settings), so people can make an active choice about whether to support mods.
| BoolVariable( | ||
| "disable_path_overrides", | ||
| "Disable CLI arguments to override project path/main pack/scene and run scripts (export template only)", | ||
| True, |
There was a problem hiding this comment.
It feels a bit weird to me that disable_path_overrides is silently ignored when building an editor build. But I'm not sure if it's important to fix this.
There was a problem hiding this comment.
If I understand it correctly, this would require users to start editing the overrides.cfg to inject mods?
Or editing PCK, or both.
It feels a bit weird to me that disable_path_overrides is silently ignored when building an editor build.
It is, but I'm not sure how to handle it, since it's both enabled for editor and disabled for templates by default.
There was a problem hiding this comment.
The main solution in my mind would be to have it 'unspecified' by default, and if it's specified it overrides the defaults. But I'm not sure if we do this for any other options, plus the editor wouldn't function as expected with the option explicitly enabled anyway. So it's probably fine to keep it as is.
There was a problem hiding this comment.
We have some options that will automatically infer their status based on if it's an editor build or not, but those are more options for the SCons environment itself rather than actual arguments iirc. Unsure how much effort it would take to make that "just work" natively
|
Looks like at least one person is actively (trying to) use |
|
EDIT: Actually, the OP says it's not critical, so we'll go ahead with removing it. |
|
Thanks! |
|
With this PR I can no longer run an exported Android project. Using the default config for Android exports, I get an endless spam of I have not done anything to specify Scene path on the command line. It sounds like Android exports were implicitly relying on path overrides somewhere. |
Will check it in a moment, it should not depend on scene path. |
Looks like the logic is just incorrect It currently fails without even checking if scene paths are used In other words, when override path is disabled it just always fails if it reaches this block. But it reaches this block if there is an argument starting with "-", so it catches way too much |
|
Yes, it's likely it, and should only disable in the |
Ya, it should only fail if the user attempts to use a scene_path. If scene_path is empty, it shouldn't fail |
|
It seems I'm a bit late to the party, but I wanted to add that I have developed some mod loaders for Godot-based games (https://github.com/FeldrinH/TASmaniac, https://github.com/FeldrinH/Luckloader) and the I'm not sure I understand why this needed to be disabled by default, while override.cfg based injection points remain enabled by default. |
|
Also, am I correct that with this change all options to override the main loop are disabled by default? TASmaniac (linked above) currently overrides the main loop to sleep between frames (this is used together with --fixed-fps to get fully deterministic frame times while running the game in real time). |
Unlike Also,
Yes, main loop override is disabled as well. All these options existed for development purpose only, are still available in the editor builds, and can be enabled for a custom build. |
That's kind of unfortunate for me, since I'm trying to mod games using release builds. I guess I'll have to see if I can make things work without control over the main loop. |
Sorry about making things more difficult for you! If you have been relying on main loop replacement, I want to encourage you to open a proposal to re-implement this in a way more similar to |
Thanks, I appreciate it. I'll have to take some time to experiment, right now I'm not fully clear on what has been restricted and how many of the restricted features I strictly need. |
|
Just to be clear, can I use override.cfg to change |
Yes, this should work (have not tested, but this kind of overrides was not disabled). |
|
I was just hit with this while exporting demos for a project of mine (non-game project, but runs a TCP connection to interact with a non-Godot game). Instead of exporting a full executable + pck for each demo, I was exporting a single executable, all pck files, and made small .sh/.bat files that were calling It looks like I can work around the issue with a little hack: renaming the executable to correspond to each pck in the corresponding .sh/.bat file seems to do the trick. |
Follow up to #108818
Splits
disable_overridesinto two:disable_overrides- disabled by default, only affect project config override (which can be also disabled via project setting).disable_path_overrides- enabled by default, disables project path/pack overrides and script CLI arguments, and forces PCK/project loading from executable or resource directory instead of CWD to ensure only project files bundled with executable are loaded.