mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-21 22:39:12 +00:00
Fix crash in Bitwarden importer when encountering a bad URI
This commit is contained in:
parent
5cf8f73193
commit
bcbe5f33d4
1 changed files with 13 additions and 3 deletions
|
@ -26,6 +26,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class BitwardenImporter extends DatabaseImporter {
|
public class BitwardenImporter extends DatabaseImporter {
|
||||||
public BitwardenImporter(Context context) {
|
public BitwardenImporter(Context context) {
|
||||||
|
@ -110,8 +111,17 @@ public class BitwardenImporter extends DatabaseImporter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GoogleAuthInfo parseUri(String obj) throws EncodingException, OtpInfoException, URISyntaxException, GoogleAuthInfoException {
|
private static GoogleAuthInfo parseUri(String s) throws EncodingException, OtpInfoException, URISyntaxException, GoogleAuthInfoException {
|
||||||
Uri uri = Uri.parse(obj);
|
Uri uri = Uri.parse(s);
|
||||||
return uri.getScheme().equals("steam") ? new GoogleAuthInfo(new SteamInfo(Base32.decode(uri.getAuthority())), "Steam account", "Steam") : GoogleAuthInfo.parseUri(uri);
|
if (Objects.equals(uri.getScheme(), "steam")) {
|
||||||
|
String secretString = uri.getAuthority();
|
||||||
|
if (secretString == null) {
|
||||||
|
throw new GoogleAuthInfoException(uri, "Empty secret (empty authority)");
|
||||||
|
}
|
||||||
|
byte[] secret = Base32.decode(secretString);
|
||||||
|
return new GoogleAuthInfo(new SteamInfo(secret), "Steam account", "Steam");
|
||||||
|
}
|
||||||
|
|
||||||
|
return GoogleAuthInfo.parseUri(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue