-
Notifications
You must be signed in to change notification settings - Fork 60
Remove courtesy file formats + Load the train plugin before loading the route #670
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
Conversation
|
If the train plugin is loaded before anything else, this meant that we can make an object that load a specific texture Then fetch a texture file from online sources that can provide the latest news, and replace the old This will allow us to display the latest news inside the train just like in real life to make the game experience more realistic, all without having to manually restart the loading progress via the plugin. |
|
I'm somewhat underwhelmed by the idea of moving the train plugin initialization like this. The essential trouble is that (especially with legacy Win32 stuff), we have no idea on what's going on in the plugin internally. Online textures: The CSV / B3D plugin would then fetch the file and use as per a texture. |
|
The timing is indeed a potential problem for plugins that rely too much on system timers... I hope at least there's an optional way to load a plugin before loading everything else. Loading a plugin earlier gives it more power to affect things. |
|
Opened the following PR with texture URLs: (I keep on intending to push a release soon, will aim to merge this after that, along with the GL menu and animated GIF code) Can you clarify exactly what you're trying to do with affecting the loading process? |
|
This is again about some anti-piracy issues. I have been still working on these issues due to their severity. Basically, a dummy train and a route will be generated with the sole purpose of loading this plugin, while the actually route and train contents being packaged in a single large ASSET package. Because the plugin is loaded after the train is loaded, to affect the loading of the route and train, it has to use reflection to reset the CurrentRoute and Renderer, then restart the loading progress. Because there currently isn't a function to perform this ( An alternative would be a way for a route or a train to specify their custom route/object/texture loading plugins required, and loading them before the route/train is actually loaded. |
|
This is quite a hacky implementation, but there doesn't seem to be any elegant way to do this. The rest of it is already finished, and the only thing it needs is to load the DLL before the route loading starts. |
|
Your 'copyright protection technique' is nothing more than an incredibly dangerous variant of the ZipSlip attack technique: An attacker could quite easily put anything in the encrypted archive, which your 'fake' train loading plugin will then quite happily chuck out. There's no way I'm deliberately merging something designed to do this- It's irresponsible and dangerous. |
|
I think you misunderstood the behavior of my plugin. It doesn't "extract" anything. It intercepts OpenBVE's attempts to read files, and return data in the package instead of data on the disk. Nothing is written to the user's disk in the whole process. What we're requesting is just a way to call a function in the train plugin before the route and train loading starts. And I'm not asking for merging the plugin, which is refused years ago. |
|
I'm not misunderstanding it at all. I'm afraid you're showing a complete disregard for best developmental and security practices in the name of copyright protection. You're passing out an arbritary encrypted archive, the contents of which then get loaded completely unsanitized, and you seem to think this is a good idea as we can already do that. Whilst you've got a (minor) point there, I can upload any given train plugin / content plugin to somewhere such as VirusTotal, or run it through my own antivirus, You can't do that with an encrypted archive...... You also say that the community doesn't care about this sort of issue. I agree with you there, but as a responsible developer / maintainer, it's my job to protect people from what they don't care about or understand. |
|
My point is that it's not comparable to the "ZipSlip attack technique". Especially when the plugin is loaded before the route and train loads. Even though the plugin patches the FileSystem Apis at the time it's loaded, OpenBVE will not actively load any DLL files after that, and given that my plugin also doesn't load any DLLs, that means there's no arbitary code execution from that archive file. And the only plugin that's getting loaded is this plugin that patches the FileSystem Apis, which is stored outside (since the apis are original when it's loaded), you can easily use an antivirus software to confirm its behavior. The worries are
Again, this is just requesting calling another function at an earlier time, and we are talking about whether it's a good idea to load a plugin 30s earlier, rather than whether it's a good idea to load encrypted contents. I personally think disapproving an application is not a strong reason to not supporting an interface. |
|
It's 100% directly comparable. Your asset bundle encoder creates an encrypted ZIP file, nothing more complicated than that. By the looks of things, you've got an encryption key and a checksum in the routefile. With a little decompiling / reversing (I note you're using some sort of code obsfucation, but this doesn't stop someone determined), it'll be trivial to supply an arbritrary archive. Your encoder doesn't even seem to block the archiving of DLLs etc. from the route folder..... The contents of this archive have to be decrypted / extracted somewhere, before being loaded into the existing plugins, which absolutely expose us to arbritray code execution and ZipSlip / similar vunerabilities. You then use Harmony ( https://harmony.pardeike.net/articles/intro.html ) to modify in memory the filesystem APIs (bluntly, this is virus-like behavious in itself). This will not be merged; it's messing with timings, and is highly likely to have unexpected effects. If you want a 'correct' way for a plugin to actually achieve a game reset, a far more appropriate place for it would be a delegate method in the Runtime API, as per: This wouldn't affect the timing of existing method calls or break backwards compatability. |
|
Sorry for the disagreement. Then I'll take the "'correct' way for a plugin to actually achieve a game reset" solution. I hope there's a function that when called will reset the game status and then reload the current route, train and train plugins, without restarting the process. This is roughly equivalent to loading a plugin before the route loads, with the difference of wasting some time (since the first loading got discarded). Please also remove the FileFormats since it's no longer needed, and might have a minor impact on loading performance. |
This PR contains two main changes.
FileFormats.IsNautilusFilefunction is removed since the request at Control over the sequence of the plugins #459 is no longer needed.This change is to enable train plugins to affect the loading progress, by placing hooks on FileSystem Apis.
In the current implementation, if a train plugin wants to achieve this, it'll have to reset the game status and restart the loading by performing a lot of internal reflection calls, for example:
This method extends the loading time, and internal changes in OpenBVE can easily break its compatibility.
By loading the plugin before the route loads, the plugin can reliably alter the loading process of the route. This also eliminates the risk of future incompatibility due to internal changes.