twofas / 2fas-android

Source code for 2FAS Android app
GNU General Public License v3.0
817 stars 65 forks source link

bug: Brand overwriting issuer for self-hosted services makes multiple instances indistinguishable #157

Open smrqdt opened 2 weeks ago

smrqdt commented 2 weeks ago

Bug type

Other

App version

5.4.5

Device environment

Android 11

Bug description

When adding at a self-hosted service (e.g. authentik) the user might have access to multiple instances of that service with different credentials.

Given the following otpauth URLs (note the different issuers):

After importing the entries look like this:

Screenshot_20240708-065405

2FAS sees the authentik substring and selects the authentik brand, which I generally like, because it adds the icon. But the brand will also overwrite the issuer, which contains information about which authentik instance the token belongs to. If the user has access to multiple authentik instances with the same username, the services become indistinguishable, because they’re all named "authentik".

authentik is just an example, different self-hosted applications might use different issuers. authentik uses the instance brand name as issuer, so depending on if the installation uses the word authentik in the instance brand name, this problem will occur, but other applications might enforce such a naming scheme.

Solution

Do not overwrite the issuer name provided by the otpauth URL by the brand name, or introduce a special flag for self-hosted brands, to not do so.

Additional context

103 might be partly related

Acknowledgements

smrqdt commented 2 weeks ago

After adding additional accounts I encountered something worse:

I have and Posteo.de mail account, and every time the Label is something like Some Service:foo.bar@posteo.de (the mail address correctly in the accountname part), 2FAS selects Posteo as brand and overwrites the Name.

Here is an example:

otpauth://totp/example.com:foo.bar@posteo.de?secret=ABCDEF00&algorithm=SHA1&digits=6&period=30&issuer=example.com

Screenshot_20240708-111504~2

elliotwutingfeng commented 2 weeks ago

Also related: #130