When is the ability to trigger a panic a bug? #1526
-
I was originally going to ask when, if ever, it is a vulnerability for untrusted data to be able to trigger a panic, because in principle this may be a denial of service vulnerability. But I figured I’d ask the broader question as well. I mean this in the context of gitoxide. My main motivation is to hone my mindset when reading and working on the code. But I do have a few specific concerns:
(Disclosure considerations: I originally inquired about this privately due to the security connection, but the UTF-8 situation is already publicly known, so it was decided that this can become a public discussion here.) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
(Mostly pasting my previous private response) Panics are considered bugs, even though some parts where it's inconvenient to handle errors properly also panic. That behaviour is really only 'allowed' on Windows in relation to illformed Unicode. It would also be a problem if illformed unicode could be used to bring down server processes, so codepaths that are run there certainly should be handling these as errors instead. All in all, the error handling related to illformed Unicode is a compromise which probably can be exploited and used as DoS in some shape or form. There are probably some places where code uses a panicking version of gix_path::*() functions even though it could also use an erroring one, and avoiding this would make the API more robust. If panics occur in other places, then they are definitely a bug that's up for immediate fixing. |
Beta Was this translation helpful? Give feedback.
(Mostly pasting my previous private response)
Panics are considered bugs, even though some parts where it's inconvenient to handle errors properly also panic. That behaviour is really only 'allowed' on Windows in relation to illformed Unicode.
It would also be a problem if illformed unicode could be used to bring down server processes, so codepaths that are run there certainly should be handling these as errors instead.
All in all, the error handling related to illformed Unicode is a compromise which probably can be exploited and used as DoS in some shape or form.
There are probably some places where code uses a panicking version of gix_path::*() functions even though it could also use an…