From 0e6608d938af44b8db31440f94cfbb39d9a97d98 Mon Sep 17 00:00:00 2001 From: Andrey Pleskach Date: Tue, 11 Jul 2023 20:58:22 +0200 Subject: [PATCH] Bump JSON libs (#2926) Signed-off-by: Andrey Pleskach --- build.gradle | 27 ++++++++++++++----- .../compliance/FieldReadCallback.java | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index c974091966..90888ac548 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,7 @@ buildscript { apache_cxf_version = '4.0.2' open_saml_version = '4.3.0' one_login_java_saml = '2.9.0' + jjwt_version = '0.11.5' guava_version = '32.1.1-jre' jaxb_version = '2.3.8' @@ -489,10 +490,26 @@ dependencies { implementation 'commons-cli:commons-cli:1.5.0' implementation "org.bouncycastle:bcprov-jdk15to18:${versions.bouncycastle}" implementation 'org.ldaptive:ldaptive:1.2.3' - implementation 'io.jsonwebtoken:jjwt-api:0.10.8' - implementation 'com.github.wnameless:json-flattener:0.5.0' - implementation 'com.flipkart.zjsonpatch:zjsonpatch:0.4.4' + //JWT + implementation "io.jsonwebtoken:jjwt-api:${jjwt_version}" + implementation "io.jsonwebtoken:jjwt-impl:${jjwt_version}" + implementation "io.jsonwebtoken:jjwt-jackson:${jjwt_version}" + // JSON flattener + implementation ("com.github.wnameless.json:json-base:2.4.0") { + exclude group: "org.glassfish", module: "jakarta.json" + exclude group: "com.google.code.gson", module: "gson" + exclude group: "org.json", module: "json" + } + implementation 'com.github.wnameless.json:json-flattener:0.16.4' + // JSON patch + implementation 'com.flipkart.zjsonpatch:zjsonpatch:0.4.14' + implementation 'org.apache.commons:commons-collections4:4.4' + + //JSON path + implementation 'com.jayway.jsonpath:json-path:2.8.0' + implementation 'net.minidev:json-smart:2.4.11' + implementation "org.apache.kafka:kafka-clients:${kafka_version}" runtimeOnly 'net.minidev:accessors-smart:2.4.7' @@ -536,10 +553,6 @@ dependencies { implementation "com.nulab-inc:zxcvbn:1.7.0" - implementation 'com.jayway.jsonpath:json-path:2.4.0' - implementation 'net.minidev:json-smart:2.4.10' - runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.10.8' - runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.10.8' runtimeOnly 'com.google.guava:failureaccess:1.0.1' runtimeOnly 'org.apache.commons:commons-text:1.10.0' runtimeOnly "org.glassfish.jaxb:jaxb-runtime:${jaxb_version}" diff --git a/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java b/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java index 73f536c2f8..5fc1c73128 100644 --- a/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java +++ b/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java @@ -105,7 +105,7 @@ public void binaryFieldRead(final FieldInfo fieldInfo, byte[] fieldValue) { fieldValue = Utils.jsonMapToByteArray(filteredSource); } - Map filteredSource = new JsonFlattener(new String(fieldValue, StandardCharsets.UTF_8)).flattenAsMap(); + final Map filteredSource = JsonFlattener.flattenAsMap(new String(fieldValue, StandardCharsets.UTF_8)); for (String k : filteredSource.keySet()) { if (!recordField(k, filteredSource.get(k) instanceof String)) { continue;