From a3c5fa92a2879192d7e794bdf6ef77f9153ab542 Mon Sep 17 00:00:00 2001 From: Max Ustinov Date: Fri, 12 Apr 2024 12:24:47 -0700 Subject: [PATCH] REL-4407 - KSM Java SDK v16.6.4 (#581) - KSM-501 - Switched to non srtict JSON parser (KSM-501 - Java SDK: Switched to non srtict JSON parser and bumping deps versions #579) - KSM-506 - Adding support for Privacy screen in the passkey field type - Upgraded dependencies to latest versions - Upgraded to gradle-8.6 --- sdk/java/core/README.md | 5 +++++ sdk/java/core/build.gradle.kts | 18 +++++++++--------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../secretsManager/core/RecordData.kt | 3 ++- .../secretsManager/core/SecretsManager.kt | 16 +++++++++------- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/sdk/java/core/README.md b/sdk/java/core/README.md index fb4efcc3..af3359fc 100644 --- a/sdk/java/core/README.md +++ b/sdk/java/core/README.md @@ -4,6 +4,11 @@ For more information see our official documentation page https://docs.keeper.io/ # Change Log +## 16.6.4 +- KSM-501 - Switched to non-strict JSON parser +- KSM-506 - Adding support for Privacy screen in the passkey field type +- Upgraded some dependencies to latest versions and gradle to gradle-8.6 + ## 16.6.3 - KSM-486 - Fix security provider not supporting AES/CBC/PKCS7Padding - KSM-473 - Make Notation function public diff --git a/sdk/java/core/build.gradle.kts b/sdk/java/core/build.gradle.kts index 0af2c137..0c02def1 100644 --- a/sdk/java/core/build.gradle.kts +++ b/sdk/java/core/build.gradle.kts @@ -6,12 +6,12 @@ import java.util.* group = "com.keepersecurity.secrets-manager" // During publishing, If version ends with '-SNAPSHOT' then it will be published to Maven snapshot repository -version = "16.6.3" +version = "16.6.4" plugins { `java-library` - kotlin("jvm") version "1.9.20" - kotlin("plugin.serialization") version "1.9.20" + kotlin("jvm") version "1.9.23" + kotlin("plugin.serialization") version "1.9.23" `maven-publish` signing id("io.github.gradle-nexus.publish-plugin") version "1.3.0" @@ -42,18 +42,18 @@ repositories { dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.9.20")) + implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.9.23")) // Use the Kotlin JDK 8 standard library. - api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0") - implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.20") + api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") + implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.23") // Use the Kotlin test library. - testImplementation("org.jetbrains.kotlin:kotlin-test:1.9.20") + testImplementation("org.jetbrains.kotlin:kotlin-test:1.9.23") // Use the Kotlin JUnit integration. - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.9.20") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.9.23") testImplementation("org.bouncycastle:bc-fips:1.0.2.4") // testImplementation("org.bouncycastle:bcprov-jdk15on:1.70") diff --git a/sdk/java/core/gradle/wrapper/gradle-wrapper.properties b/sdk/java/core/gradle/wrapper/gradle-wrapper.properties index f4a5f9b6..b719751c 100644 --- a/sdk/java/core/gradle/wrapper/gradle-wrapper.properties +++ b/sdk/java/core/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt index 6736276e..beaa0444 100644 --- a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt +++ b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/RecordData.kt @@ -593,8 +593,9 @@ data class Passkey @JvmOverloads constructor( data class Passkeys @JvmOverloads constructor( override val label: String? = null, var required: Boolean? = null, + var privacyScreen: Boolean? = null, val value: MutableList) : KeeperRecordField() { - constructor(value: Passkey): this(null, null, mutableListOf(value)) + constructor(value: Passkey): this(null, null, null, mutableListOf(value)) } @Serializable diff --git a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt index 832b5123..a702a296 100644 --- a/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt +++ b/sdk/java/core/src/main/kotlin/com/keepersecurity/secretsManager/core/SecretsManager.kt @@ -17,7 +17,7 @@ import java.util.* import java.util.concurrent.* import javax.net.ssl.* -const val KEEPER_CLIENT_VERSION = "mj16.6.3" +const val KEEPER_CLIENT_VERSION = "mj16.6.4" const val KEY_HOSTNAME = "hostname" // base url for the Secrets Manager service const val KEY_SERVER_PUBIC_KEY_ID = "serverPublicKeyId" @@ -800,21 +800,23 @@ private fun decryptRecord(record: SecretsManagerResponseRecord, recordKey: ByteA // When SDK is behind/ahead of record/field type definitions then // strict mapping between JSON attributes and object properties - // will fail on any unknown field/key so just skip the record with proper error message + // will fail on any unknown field/key - currently just log the error + // and continue without the field - nb! field will be lost on save + var recordData: KeeperRecordData? = null try { - val recordData = Json.decodeFromString(bytesToString(decryptedRecord)) - return KeeperRecord(recordKey, record.recordUid, null, null, record.innerFolderUid, recordData, record.revision, files) + recordData = Json.decodeFromString(bytesToString(decryptedRecord)) } catch (e: Exception) { // New/missing field: Polymorphic serializer was not found for class discriminator 'UNKNOWN'... // New/missing field property (field def updated): Encountered unknown key 'UNKNOWN'. // Avoid 'ignoreUnknownKeys = true' to prevent erasing new properties on save/update - println("Skipped record ${record.recordUid}\n"+ + println("Record ${record.recordUid} has unexpected data properties (ignored).\n"+ " Error parsing record type - KSM SDK is behind/ahead of record/field type definitions." + " Please upgrade to latest version. If you need assistance please email support@keepersecurity.com") - println(e.message) + //println(e.message) + recordData = nonStrictJson.decodeFromString(bytesToString(decryptedRecord)) } - return null + return if (recordData != null) KeeperRecord(recordKey, record.recordUid, null, null, record.innerFolderUid, recordData, record.revision, files) else null } @ExperimentalSerializationApi