You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2021/12/27 03:13:00 UTC

[kylin] branch kylin3 updated: test fix

This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch kylin3
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/kylin3 by this push:
     new 694d94b  test fix
694d94b is described below

commit 694d94b270b3f2722e590cb552816d0b2d3dda3c
Author: yaqian.zhang <59...@qq.com>
AuthorDate: Tue Dec 7 16:59:42 2021 +0800

    test fix
---
 .../main/java/org/apache/kylin/common/KylinConfigBase.java  |  3 +++
 .../main/java/org/apache/kylin/common/util/EncryptUtil.java |  3 ++-
 .../java/org/apache/kylin/common/util/EncryptUtilTest.java  | 13 ++++++++++++-
 server/src/main/webapp/WEB-INF/web.xml                      |  2 +-
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
index 707848f..947cc24 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
@@ -2740,4 +2740,7 @@ public abstract class KylinConfigBase implements Serializable {
         return getOptional("kylin.jdbc.url.allowed.sqlserver.schema", DEFAULT_JDBC_URL_ALLOWED_SQLSERVER_SCHEMA);
     }
 
+    public String getEncryptCipherIvSpec() {
+        return getOptional("kylin.security.encrypt.cipher.ivSpec", "AAAAAAAAAAAAAAAA");
+    }
 }
diff --git a/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java b/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java
index b9b4ddb..224c9e8 100644
--- a/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java
+++ b/core-common/src/main/java/org/apache/kylin/common/util/EncryptUtil.java
@@ -25,6 +25,7 @@ import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
 
 import org.apache.commons.codec.binary.Base64;
+import org.apache.kylin.common.KylinConfig;
 
 import javax.crypto.Cipher;
 import javax.crypto.NoSuchPaddingException;
@@ -42,7 +43,7 @@ public class EncryptUtil {
             InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, UnsupportedEncodingException {
         Cipher cipher = Cipher.getInstance("AES/CFB/PKCS5Padding");
         final SecretKeySpec secretKey = new SecretKeySpec(key, "AES");
-        IvParameterSpec ivSpec = new IvParameterSpec("AAAAAAAAAAAAAAAA".getBytes("UTF-8"));
+        IvParameterSpec ivSpec = new IvParameterSpec(KylinConfig.getInstanceFromEnv().getEncryptCipherIvSpec().getBytes("UTF-8"));
         cipher.init(cipherMode, secretKey, ivSpec);
         return cipher;
     }
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/EncryptUtilTest.java b/core-common/src/test/java/org/apache/kylin/common/util/EncryptUtilTest.java
index da985ca..5cb8899 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/EncryptUtilTest.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/EncryptUtilTest.java
@@ -18,10 +18,21 @@
 
 package org.apache.kylin.common.util;
 
+import org.junit.After;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 
-public class EncryptUtilTest {
+public class EncryptUtilTest extends LocalFileMetadataTestCase {
+    @Before
+    public void setUp() throws Exception {
+        this.createTestMetadata();
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
 
     @Test
     public void testAESEncrypt(){
diff --git a/server/src/main/webapp/WEB-INF/web.xml b/server/src/main/webapp/WEB-INF/web.xml
index 8602c71..f9849b8 100644
--- a/server/src/main/webapp/WEB-INF/web.xml
+++ b/server/src/main/webapp/WEB-INF/web.xml
@@ -75,7 +75,7 @@
    </init-param>     
   <init-param>
       <param-name>cors.supportsCredentials </param-name>
-      <param-value>true</param-value>
+      <param-value>false</param-value>
    </init-param>    
 </filter>