freeotp / freeotp-ios

Apache License 2.0
686 stars 173 forks source link

Possible issue with invalid image parameter #340

Closed volinthius closed 6 months ago

volinthius commented 10 months ago

Assuming that we input a QR code that resolves to this kind of key URI the application is stuck crashing on startup:

otpauth://totp/Example%20Something:john.doe@example.com?secret=EHH4EHH4EHH4EHH4EHH4EHH4EHH4EHH4EHH4EHH4EHH4EHH4EHH4&issuer=Example%20Something&image=undefined/images/example.png

Seen on iOS with FreeOTP 2.3.4.

volinthius commented 10 months ago

I assume that the token is stored with the invalid image parameter. And furthermore I assume that when TokenViewController tries to download the image an error happens in ImageDownloader with the missing scheme:

func fromURL(_ url: URL, _ iv: UIImageView, completion: @escaping (UIImage) -> Void) {
        switch url.scheme! {
justin-stephenson commented 7 months ago

@volinthius does this occur for any 'issuer' value present in the Token URI? With added FontAwesome icon support the 'image' URI is not commonly used but this is a bug that needs to be fixed.

volinthius commented 7 months ago

Unfortunately the application is stuck crashing on startup even after removing (with data removed as well) and reinstalling. So I cannot retry with another issuer.