From c01fc626585679c7167fc5f09c7cd5271f5c1556 Mon Sep 17 00:00:00 2001 From: David Perez Date: Wed, 22 Apr 2026 16:06:54 -0500 Subject: [PATCH] SDK Update - com.bitwarden:sdk-android 2.0.0-6340-00b609f9 (#6823) --- ...ServerCommunicationConfigRepositoryImpl.kt | 23 +++++++++++-------- ...ServerCommunicationConfigRepositoryTest.kt | 2 +- gradle/libs.versions.toml | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/sdk/repository/ServerCommunicationConfigRepositoryImpl.kt b/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/sdk/repository/ServerCommunicationConfigRepositoryImpl.kt index d67757364d..6969b47839 100644 --- a/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/sdk/repository/ServerCommunicationConfigRepositoryImpl.kt +++ b/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/sdk/repository/ServerCommunicationConfigRepositoryImpl.kt @@ -21,7 +21,7 @@ class ServerCommunicationConfigRepositoryImpl( private val configDiskSource: ConfigDiskSource, ) : ServerCommunicationConfigRepository { - override suspend fun get(hostname: String): ServerCommunicationConfig? { + override suspend fun get(domain: String): ServerCommunicationConfig? { val serverData = configDiskSource.serverConfig?.serverData val serverCommunicationConfig = serverData?.communication ?: return null @@ -31,8 +31,13 @@ class ServerCommunicationConfigRepositoryImpl( ) } + // We return null here since we do not have the appropriate data to complete the + // transaction. This will trigger a cookie acquisition with the server. + val vaultUrl = serverData.environment?.vaultUrl ?: return null + val cookieName = serverCommunicationConfig.bootstrap.cookieName ?: return null + val cookieDomain = serverCommunicationConfig.bootstrap.cookieDomain ?: return null val acquiredCookies = cookieDiskSource - .getCookieConfig(hostname) + .getCookieConfig(hostname = domain) ?.cookies ?.toAcquiredCookiesList() @@ -40,24 +45,24 @@ class ServerCommunicationConfigRepositoryImpl( bootstrap = BootstrapConfig.SsoCookieVendor( v1 = SsoCookieVendorConfig( idpLoginUrl = serverCommunicationConfig.bootstrap.idpLoginUrl, - vaultUrl = serverData.environment?.vaultUrl, - cookieName = serverCommunicationConfig.bootstrap.cookieName, - cookieDomain = serverCommunicationConfig.bootstrap.cookieDomain, + vaultUrl = vaultUrl, + cookieName = cookieName, + cookieDomain = cookieDomain, cookieValue = acquiredCookies, ), ), ) } - override suspend fun save(hostname: String, config: ServerCommunicationConfig) = + override suspend fun save(domain: String, config: ServerCommunicationConfig) = when (val bootstrapConfig = config.bootstrap) { is BootstrapConfig.SsoCookieVendor -> { // Only store cookies from [config]. The communication config is synced with the // server (api/config), which takes precedence over the local configuration. cookieDiskSource.storeCookieConfig( - hostname = hostname, + hostname = domain, config = CookieConfigurationData( - hostname = hostname, + hostname = domain, cookies = bootstrapConfig.v1.cookieValue ?.toConfigurationDataCookies() .orEmpty(), @@ -68,7 +73,7 @@ class ServerCommunicationConfigRepositoryImpl( BootstrapConfig.Direct -> { // Clear any existing cookie configuration now that the communication config // has been updated. - cookieDiskSource.storeCookieConfig(hostname = hostname, config = null) + cookieDiskSource.storeCookieConfig(hostname = domain, config = null) } } } diff --git a/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/datasource/sdk/ServerCommunicationConfigRepositoryTest.kt b/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/datasource/sdk/ServerCommunicationConfigRepositoryTest.kt index 2a9e7066fb..8b2c98eff0 100644 --- a/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/datasource/sdk/ServerCommunicationConfigRepositoryTest.kt +++ b/app/src/test/kotlin/com/x8bit/bitwarden/data/platform/datasource/sdk/ServerCommunicationConfigRepositoryTest.kt @@ -193,7 +193,7 @@ class ServerCommunicationConfigRepositoryTest { bootstrap = BootstrapConfig.SsoCookieVendor( v1 = SsoCookieVendorConfig( idpLoginUrl = "https://$hostname/proxy-cookie-redirect-connector", - vaultUrl = null, + vaultUrl = "https://api.bitwarden.com", cookieName = "session", cookieDomain = hostname, cookieValue = null, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e39bf725b4..5549b981cd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -30,7 +30,7 @@ androidxRoom = "2.8.4" androidxSecurityCrypto = "1.1.0" androidxSplash = "1.2.0" androidxWork = "2.11.2" -bitwardenSdk = "2.0.0-6312-3e1ead66" +bitwardenSdk = "2.0.0-6340-00b609f9" crashlytics = "3.0.7" detekt = "1.23.8" firebaseBom = "34.12.0"