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 {
|
passkey?.let {
|
||||||
mUsageParameters?.let { usageParameters ->
|
mUsageParameters?.let { usageParameters ->
|
||||||
// Check verified origin
|
// Check verified origin
|
||||||
usageParameters.androidApp.checkInAppOrigin(
|
if (usageParameters.androidAppVerified) {
|
||||||
appOrigin = appOrigin,
|
PendingIntentHandler.setGetCredentialResponse(
|
||||||
onOriginChecked = {
|
responseIntent,
|
||||||
usageParameters.androidAppVerified = true
|
GetCredentialResponse(
|
||||||
PendingIntentHandler.setGetCredentialResponse(
|
buildPasskeyPublicKeyCredential(
|
||||||
responseIntent,
|
usageParameters = usageParameters,
|
||||||
GetCredentialResponse(
|
passkey = passkey
|
||||||
buildPasskeyPublicKeyCredential(
|
|
||||||
usageParameters = usageParameters,
|
|
||||||
passkey = passkey
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
},
|
)
|
||||||
onOriginNotChecked = {
|
} else {
|
||||||
throw SecurityException("Wrong signature for ${usageParameters.androidApp.id}")
|
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 {
|
} ?: run {
|
||||||
throw IOException("Usage parameters is null")
|
throw IOException("Usage parameters is null")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ data class PublicKeyCredentialUsageParameters(
|
|||||||
val publicKeyCredentialRequestOptions: PublicKeyCredentialRequestOptions,
|
val publicKeyCredentialRequestOptions: PublicKeyCredentialRequestOptions,
|
||||||
val clientDataResponse: ClientDataResponse,
|
val clientDataResponse: ClientDataResponse,
|
||||||
val androidApp: AppIdentifier,
|
val androidApp: AppIdentifier,
|
||||||
var androidAppVerified: Boolean
|
val androidAppVerified: Boolean
|
||||||
)
|
)
|
||||||
@@ -45,7 +45,7 @@ class OriginManager(
|
|||||||
onOriginRetrieved = { appIdentifier, callOrigin, clientDataHash ->
|
onOriginRetrieved = { appIdentifier, callOrigin, clientDataHash ->
|
||||||
onOriginRetrieved(
|
onOriginRetrieved(
|
||||||
AppOrigin().apply {
|
AppOrigin().apply {
|
||||||
addIdentifier(appIdentifier)
|
// Do not store Web Browser AppId -> addIdentifier(appIdentifier)
|
||||||
addWebDomain(callOrigin)
|
addWebDomain(callOrigin)
|
||||||
},
|
},
|
||||||
clientDataHash
|
clientDataHash
|
||||||
|
|||||||
@@ -83,7 +83,11 @@ object AppOriginEntryField {
|
|||||||
// If unable to save web domain in custom field or URL not populated, save in URL
|
// If unable to save web domain in custom field or URL not populated, save in URL
|
||||||
webDomain?.let {
|
webDomain?.let {
|
||||||
val webScheme = if (scheme.isNullOrEmpty()) "https" else scheme
|
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 (!containsDomainOrApplicationId(webDomain)) {
|
||||||
if (!customFieldsAllowed || url.isEmpty()) {
|
if (!customFieldsAllowed || url.isEmpty()) {
|
||||||
url = webDomainToStore
|
url = webDomainToStore
|
||||||
|
|||||||
Reference in New Issue
Block a user