ish-app / ish

Linux shell for iOS
https://ish.app
Other
16.33k stars 855 forks source link

Invalid `.json` file in `themes` folder breaks iSH #2343

Closed b- closed 2 months ago

b- commented 4 months ago

I discovered this accidentally while trying to add the Dracula theme. They link a convenient zip file from their readme, which I downloaded and decompressed as follows:

localhost:~# mount -t real "$(/proc/ish/documents)/themes" /mnt
localhost:~# cd /mnt
localhost:/mnt# wget https://github.com/urrickhunt/Dracula-for-iSH/files/11355172/Dracula.json.zip

Connecting to github.com (140.82.112.3:443)
Connecting to objects.githubusercontent.com (185.199.110.133:443)
saving to 'Dracula.json.zip'
Dracula.json.zip     100%   744  0:00:00 ETA
'Dracula.json.zip' saved

localhost:/mnt# unzip Dracula.json.zip 
Archive:  Dracula.json.zip
  inflating: Dracula.json
  inflating: __MACOSX/._Dracula.json

And poof! just like that, it instantly crashes and refuses to start again.

This does not seem to happen with other file types (that is, the zip file downloads fine and the system doesn't crash until it unpacks the __MACOSX folder we all know and love). Therefore I think that what's happening is iSH sees a .json file appear and attempts to parse it, and the parser panics with an error that isn't handled, crashing the app.

Normally I'd consider breaking an app by dropping an invalid file into its config folder as a "play stupid games & win stupid prizes" sort of issue that I wouldn't consider particularly pressing.

However, I think this is an exception because the only fix I could find is completely removing and reinstalling iSH from my iPhone.