Fail safety with invalid external resources #1553
-
Hey! I'm working on external resources support for WatchMate companion app, and by loading invalid resources content during testing I managed to brick my PineTime (stuck in the boot loop). To bring it back to life I had to unseal it, flash InfiniTime 1.10, remove invalid resources, and then upgrade back to 1.11. This was due to a bug in my early implementation (each file when loaded form the zip archive was prepended by the content of all previous files), but it could also happen with correct app but malicious or maybe corrupted resources files. So I'm wondering how resilient the firmware is / can be at handling invalid resources, and what safety checks are expected from the companion app.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @azymohliad, and thanks for your work on Watchmate! I'm sorry about your bricked PineTime, and, to be honest, I have a hard time understanding how this could have happened. Could you maybe send such corrupted resource file to this conversation? Or point me to a buggy version of Watchmate that would allow me to reproduce the issue on my devkit? Currently, we use 2 types of resources : pictures and fonts.
Yes, InfiniTime should definitely be resilient to invalid/corrupted resources, especially if we want to allow more customizations by the users.
I guess the bare minimum would be to notify the user that something wrong happened and that they should try again. As I said earlier, we should ensure that invalid/corrupt files do not prevent infinitime from working properly.
That's an interesting question... We currently haven't fixed any limitation, the FS is wide open, and the companion app can access to everything. We (InfiniTime maintainers) take care to publish a valid resource pack (.json file + binary files), but nothing prevent a user from crafting an invalid resource pack, indeed. That's probably something we need to talk about. We've already talked about this topic in this review, but took no decision so far. |
Beta Was this translation helpful? Give feedback.
-
This is definitely something worth opening an issue about. |
Beta Was this translation helpful? Give feedback.
Hi @azymohliad, and thanks for your work on Watchmate!
I'm sorry about your bricked PineTime, and, to be honest, I have a hard time understanding how this could have happened. Could you maybe send such corrupted resource file to this conversation? Or point me to a buggy version of Watchmate that would allow me to reproduce the issue on my devkit?
Currently, we use 2 types of resources : pictures and fonts.
For pictures, LVGL will try to open the file. If the file does not exist, LVGL will simply ignore it, and display nothing where the picture would have been located. If the content of the picture is not fully uploaded, lvgl will simply display garbage for the missing parts.
Regarding fon…