mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Browser selection and URL scheme
This commit is contained in:
@@ -92,24 +92,35 @@ class PasskeyLauncherActivity : DatabaseModeActivity() {
|
||||
passkey?.let {
|
||||
mUsageParameters?.let { usageParameters ->
|
||||
// Check verified origin
|
||||
usageParameters.androidApp.checkInAppOrigin(
|
||||
appOrigin = appOrigin,
|
||||
onOriginChecked = {
|
||||
usageParameters.androidAppVerified = true
|
||||
PendingIntentHandler.setGetCredentialResponse(
|
||||
responseIntent,
|
||||
GetCredentialResponse(
|
||||
buildPasskeyPublicKeyCredential(
|
||||
usageParameters = usageParameters,
|
||||
passkey = passkey
|
||||
)
|
||||
if (usageParameters.androidAppVerified) {
|
||||
PendingIntentHandler.setGetCredentialResponse(
|
||||
responseIntent,
|
||||
GetCredentialResponse(
|
||||
buildPasskeyPublicKeyCredential(
|
||||
usageParameters = usageParameters,
|
||||
passkey = passkey
|
||||
)
|
||||
)
|
||||
},
|
||||
onOriginNotChecked = {
|
||||
throw SecurityException("Wrong signature for ${usageParameters.androidApp.id}")
|
||||
}
|
||||
)
|
||||
)
|
||||
} else {
|
||||
usageParameters.androidApp.checkInAppOrigin(
|
||||
appOrigin = appOrigin,
|
||||
onOriginChecked = {
|
||||
PendingIntentHandler.setGetCredentialResponse(
|
||||
responseIntent,
|
||||
GetCredentialResponse(
|
||||
buildPasskeyPublicKeyCredential(
|
||||
usageParameters = usageParameters,
|
||||
passkey = passkey
|
||||
)
|
||||
)
|
||||
)
|
||||
},
|
||||
onOriginNotChecked = {
|
||||
throw SecurityException("Wrong signature for ${usageParameters.androidApp.id}")
|
||||
}
|
||||
)
|
||||
}
|
||||
} ?: run {
|
||||
throw IOException("Usage parameters is null")
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ data class PublicKeyCredentialUsageParameters(
|
||||
val publicKeyCredentialRequestOptions: PublicKeyCredentialRequestOptions,
|
||||
val clientDataResponse: ClientDataResponse,
|
||||
val androidApp: AppIdentifier,
|
||||
var androidAppVerified: Boolean
|
||||
val androidAppVerified: Boolean
|
||||
)
|
||||
@@ -45,7 +45,7 @@ class OriginManager(
|
||||
onOriginRetrieved = { appIdentifier, callOrigin, clientDataHash ->
|
||||
onOriginRetrieved(
|
||||
AppOrigin().apply {
|
||||
addIdentifier(appIdentifier)
|
||||
// Do not store Web Browser AppId -> addIdentifier(appIdentifier)
|
||||
addWebDomain(callOrigin)
|
||||
},
|
||||
clientDataHash
|
||||
|
||||
@@ -83,7 +83,11 @@ object AppOriginEntryField {
|
||||
// If unable to save web domain in custom field or URL not populated, save in URL
|
||||
webDomain?.let {
|
||||
val webScheme = if (scheme.isNullOrEmpty()) "https" else scheme
|
||||
val webDomainToStore = "$webScheme://$webDomain"
|
||||
val webDomainToStore = if (webDomain.contains("://")) {
|
||||
webDomain
|
||||
} else {
|
||||
"$webScheme://$webDomain"
|
||||
}
|
||||
if (!containsDomainOrApplicationId(webDomain)) {
|
||||
if (!customFieldsAllowed || url.isEmpty()) {
|
||||
url = webDomainToStore
|
||||
|
||||
Reference in New Issue
Block a user