You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by GitBox <gi...@apache.org> on 2022/09/14 16:35:06 UTC
[GitHub] [incubator-linkis] casionone opened a new pull request, #3382: Merge dev-1.3.0 into master
casionone opened a new pull request, #3382:
URL: https://github.com/apache/incubator-linkis/pull/3382
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
You can learn more about contributing to Apache Linkis here: https://linkis.apache.org/community/how-to-contribute
Happy contributing!
-->
### What is the purpose of the change
Merge dev-1.3.0 into master
### Checklist
- [x] I have read the [Contributing Guidelines on pull requests](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#pull-requests).
- [ ] I have explained the need for this PR and the problem it solves
- [ ] I have explained the changes or the new features added to this PR
- [ ] I have added tests corresponding to this change
- [ ] I have updated the documentation to reflect this change
- [ ] I have verified that this change is backward compatible (If not, please discuss on the [Linkis mailing list](https://linkis.apache.org/community/how-to-subscribe) first)
- [ ] **If this is a code change**: I have written unit tests to fully verify the new behavior.
<!--
Note
1. Mark the PR title as `[WIP] title` until it's ready to be reviewed.
如果PR还未准备好被review,请在标题上添加[WIP]标识(WIP work in progress)
2. Always add/update tests for any changes unless you have a good reason.
除非您有充分的理由,否则任何修改都需要添加/更新测试
3. Always update the documentation to reflect the changes made in the PR.
始终更新文档以反映 PR 中所做的更改
4. After the PR is submitted, please pay attention to the execution result of git action check.
If there is any failure, please adjust it in time
PR提交后,请关注git action check 执行结果,关键的check失败时,请及时修正
5. Before the pr is merged, if the commit is missing, you can continue to commit the code
在未合并前,如果提交有遗漏,您可以继续提交代码
6. After you submit PR, you can add assistant WeChat, the WeChat QR code is
https://user-images.githubusercontent.com/7869972/176336986-d6b9be8f-d1d3-45f1-aa45-8e6adf5dd244.png
您提交pr后,可以添加助手微信,微信二维码为
https://user-images.githubusercontent.com/7869972/176336986-d6b9be8f-d1d3-45f1-aa45-8e6adf5dd244.png
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org
[GitHub] [incubator-linkis] github-code-scanning[bot] commented on a diff in pull request #3382: Merge dev-1.3.0 into master
Posted by GitBox <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #3382:
URL: https://github.com/apache/incubator-linkis/pull/3382#discussion_r971054635
##########
linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java:
##########
@@ -28,111 +28,111 @@
import java.util.Base64;
public class DESUtil {
- private static final String DES = "DES";
- private static final String XBYTE = "X";
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String encrypt(String data, String key) throws Exception {
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- byte[] bt = encrypt(data.getBytes(), key.getBytes());
- return Base64.getMimeEncoder().encodeToString(bt);
+ private static final String DES = "DES";
+ private static final String XBYTE = "X";
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String encrypt(String data, String key) throws Exception {
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String decrypt(String data, String key) throws Exception {
- if (StringUtils.isBlank(data)) {
- return null;
- }
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- Base64.Decoder decoder = Base64.getMimeDecoder();
- byte[] buf = decoder.decode(data);
- byte[] bt = decrypt(buf, key.getBytes());
- return new String(bt);
+ byte[] bt = encrypt(data.getBytes(), key.getBytes());
+ return Base64.getMimeEncoder().encodeToString(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String decrypt(String data, String key) throws Exception {
+ if (StringUtils.isBlank(data)) {
+ return null;
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the decryption operation.(Cipher对象实际完成解密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
- }
-
- public static void main(String[] args) throws Exception {}
+ Base64.Decoder decoder = Base64.getMimeDecoder();
+ byte[] buf = decoder.decode(data);
+ byte[] bt = decrypt(buf, key.getBytes());
+ return new String(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+ // Generate a trusted random number source(生成一个可信任的随机数源)
+ SecureRandom sr = new SecureRandom();
+
+ // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
+ DESKeySpec dks = new DESKeySpec(key);
+
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
+ SecretKey securekey = keyFactory.generateSecret(dks);
+
+ // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
+ Cipher cipher = Cipher.getInstance(DES);
Review Comment:
## Use of a broken or risky cryptographic algorithm
Cryptographic algorithm [DES](1) is weak and should not be used.
[Show more details](https://github.com/apache/incubator-linkis/security/code-scanning/15)
##########
linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java:
##########
@@ -28,111 +28,111 @@
import java.util.Base64;
public class DESUtil {
- private static final String DES = "DES";
- private static final String XBYTE = "X";
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String encrypt(String data, String key) throws Exception {
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- byte[] bt = encrypt(data.getBytes(), key.getBytes());
- return Base64.getMimeEncoder().encodeToString(bt);
+ private static final String DES = "DES";
+ private static final String XBYTE = "X";
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String encrypt(String data, String key) throws Exception {
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String decrypt(String data, String key) throws Exception {
- if (StringUtils.isBlank(data)) {
- return null;
- }
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- Base64.Decoder decoder = Base64.getMimeDecoder();
- byte[] buf = decoder.decode(data);
- byte[] bt = decrypt(buf, key.getBytes());
- return new String(bt);
+ byte[] bt = encrypt(data.getBytes(), key.getBytes());
+ return Base64.getMimeEncoder().encodeToString(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String decrypt(String data, String key) throws Exception {
+ if (StringUtils.isBlank(data)) {
+ return null;
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the decryption operation.(Cipher对象实际完成解密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
- }
-
- public static void main(String[] args) throws Exception {}
+ Base64.Decoder decoder = Base64.getMimeDecoder();
+ byte[] buf = decoder.decode(data);
+ byte[] bt = decrypt(buf, key.getBytes());
+ return new String(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+ // Generate a trusted random number source(生成一个可信任的随机数源)
+ SecureRandom sr = new SecureRandom();
+
+ // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
+ DESKeySpec dks = new DESKeySpec(key);
+
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
+ SecretKey securekey = keyFactory.generateSecret(dks);
+
+ // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
+ Cipher cipher = Cipher.getInstance(DES);
+
+ // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
+ cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
+
+ return cipher.doFinal(data);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
+ // Generate a trusted random number source(生成一个可信任的随机数源)
+ SecureRandom sr = new SecureRandom();
+
+ // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
+ DESKeySpec dks = new DESKeySpec(key);
+
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
Review Comment:
## Use of a broken or risky cryptographic algorithm
Cryptographic algorithm [DES](1) is weak and should not be used.
[Show more details](https://github.com/apache/incubator-linkis/security/code-scanning/16)
##########
linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java:
##########
@@ -28,111 +28,111 @@
import java.util.Base64;
public class DESUtil {
- private static final String DES = "DES";
- private static final String XBYTE = "X";
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String encrypt(String data, String key) throws Exception {
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- byte[] bt = encrypt(data.getBytes(), key.getBytes());
- return Base64.getMimeEncoder().encodeToString(bt);
+ private static final String DES = "DES";
+ private static final String XBYTE = "X";
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String encrypt(String data, String key) throws Exception {
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String decrypt(String data, String key) throws Exception {
- if (StringUtils.isBlank(data)) {
- return null;
- }
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- Base64.Decoder decoder = Base64.getMimeDecoder();
- byte[] buf = decoder.decode(data);
- byte[] bt = decrypt(buf, key.getBytes());
- return new String(bt);
+ byte[] bt = encrypt(data.getBytes(), key.getBytes());
+ return Base64.getMimeEncoder().encodeToString(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String decrypt(String data, String key) throws Exception {
+ if (StringUtils.isBlank(data)) {
+ return null;
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the decryption operation.(Cipher对象实际完成解密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
- }
-
- public static void main(String[] args) throws Exception {}
+ Base64.Decoder decoder = Base64.getMimeDecoder();
+ byte[] buf = decoder.decode(data);
+ byte[] bt = decrypt(buf, key.getBytes());
+ return new String(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+ // Generate a trusted random number source(生成一个可信任的随机数源)
+ SecureRandom sr = new SecureRandom();
+
+ // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
+ DESKeySpec dks = new DESKeySpec(key);
+
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
+ SecretKey securekey = keyFactory.generateSecret(dks);
+
+ // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
+ Cipher cipher = Cipher.getInstance(DES);
+
+ // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
+ cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
+
+ return cipher.doFinal(data);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
+ // Generate a trusted random number source(生成一个可信任的随机数源)
+ SecureRandom sr = new SecureRandom();
+
+ // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
+ DESKeySpec dks = new DESKeySpec(key);
+
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
+ SecretKey securekey = keyFactory.generateSecret(dks);
+
+ // The Cipher object actually completes the decryption operation.(Cipher对象实际完成解密操作)
+ Cipher cipher = Cipher.getInstance(DES);
Review Comment:
## Use of a broken or risky cryptographic algorithm
Cryptographic algorithm [DES](1) is weak and should not be used.
[Show more details](https://github.com/apache/incubator-linkis/security/code-scanning/17)
##########
linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java:
##########
@@ -28,111 +28,111 @@
import java.util.Base64;
public class DESUtil {
- private static final String DES = "DES";
- private static final String XBYTE = "X";
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String encrypt(String data, String key) throws Exception {
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- byte[] bt = encrypt(data.getBytes(), key.getBytes());
- return Base64.getMimeEncoder().encodeToString(bt);
+ private static final String DES = "DES";
+ private static final String XBYTE = "X";
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String encrypt(String data, String key) throws Exception {
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- public static String decrypt(String data, String key) throws Exception {
- if (StringUtils.isBlank(data)) {
- return null;
- }
- if (StringUtils.isNotBlank(key) && key.length() < 8) {
- int i = key.length();
- while ((8 - i) > 0) {
- key += XBYTE;
- i++;
- }
- }
- Base64.Decoder decoder = Base64.getMimeDecoder();
- byte[] buf = decoder.decode(data);
- byte[] bt = decrypt(buf, key.getBytes());
- return new String(bt);
+ byte[] bt = encrypt(data.getBytes(), key.getBytes());
+ return Base64.getMimeEncoder().encodeToString(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ public static String decrypt(String data, String key) throws Exception {
+ if (StringUtils.isBlank(data)) {
+ return null;
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the encryption operation.(Cipher对象实际完成加密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
+ int i = key.length();
+ while ((8 - i) > 0) {
+ key += XBYTE;
+ i++;
+ }
}
-
- /**
- * Description Encryption based on key values(Description 根据键值进行加密)
- *
- * @param data
- * @param key Encryption key byte array(加密键byte数组)
- * @return Ciphertext(密文)
- * @throws Exception
- */
- private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
- // Generate a trusted random number source(生成一个可信任的随机数源)
- SecureRandom sr = new SecureRandom();
-
- // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
- DESKeySpec dks = new DESKeySpec(key);
-
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey
- // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
- SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
- SecretKey securekey = keyFactory.generateSecret(dks);
-
- // The Cipher object actually completes the decryption operation.(Cipher对象实际完成解密操作)
- Cipher cipher = Cipher.getInstance(DES);
-
- // Initialize a Cipher object with a key(用密钥初始化Cipher对象)
- cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
-
- return cipher.doFinal(data);
- }
-
- public static void main(String[] args) throws Exception {}
+ Base64.Decoder decoder = Base64.getMimeDecoder();
+ byte[] buf = decoder.decode(data);
+ byte[] bt = decrypt(buf, key.getBytes());
+ return new String(bt);
+ }
+
+ /**
+ * Description Encryption based on key values(Description 根据键值进行加密)
+ *
+ * @param data
+ * @param key Encryption key byte array(加密键byte数组)
+ * @return Ciphertext(密文)
+ * @throws Exception
+ */
+ private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+ // Generate a trusted random number source(生成一个可信任的随机数源)
+ SecureRandom sr = new SecureRandom();
+
+ // Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
+ DESKeySpec dks = new DESKeySpec(key);
+
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
Review Comment:
## Use of a broken or risky cryptographic algorithm
Cryptographic algorithm [DES](1) is weak and should not be used.
[Show more details](https://github.com/apache/incubator-linkis/security/code-scanning/14)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org
[GitHub] [incubator-linkis] codecov[bot] commented on pull request #3382: Merge dev-1.3.0 into master
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #3382:
URL: https://github.com/apache/incubator-linkis/pull/3382#issuecomment-1247061551
# [Codecov](https://codecov.io/gh/apache/incubator-linkis/pull/3382?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#3382](https://codecov.io/gh/apache/incubator-linkis/pull/3382?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c2ea94c) into [master](https://codecov.io/gh/apache/incubator-linkis/commit/fa659d39750b9fad19d144582f56e52b55fae497?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fa659d3) will **increase** coverage by `0.01%`.
> The diff coverage is `26.03%`.
```diff
@@ Coverage Diff @@
## master #3382 +/- ##
============================================
+ Coverage 14.66% 14.68% +0.01%
+ Complexity 1162 1017 -145
============================================
Files 741 677 -64
Lines 23205 23746 +541
Branches 3436 3542 +106
============================================
+ Hits 3404 3486 +82
- Misses 19338 19744 +406
- Partials 463 516 +53
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-linkis/pull/3382?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...on/errorcode/LinkisEngineConnErrorCodeSummary.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi9lcnJvcmNvZGUvTGlua2lzRW5naW5lQ29ubkVycm9yQ29kZVN1bW1hcnkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...mon/errorcode/LinkisExtensionErrorCodeSummary.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi9lcnJvcmNvZGUvTGlua2lzRXh0ZW5zaW9uRXJyb3JDb2RlU3VtbWFyeS5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...rcode/LinkisPublicEnhancementErrorCodeSummary.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi9lcnJvcmNvZGUvTGlua2lzUHVibGljRW5oYW5jZW1lbnRFcnJvckNvZGVTdW1tYXJ5LmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...code/LinkisSpringCloudServiceErrorCodeSummary.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi9lcnJvcmNvZGUvTGlua2lzU3ByaW5nQ2xvdWRTZXJ2aWNlRXJyb3JDb2RlU3VtbWFyeS5qYXZh) | `0.00% <0.00%> (ø)` | |
| [.../main/java/org/apache/linkis/common/io/FsPath.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi9pby9Gc1BhdGguamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [.../org/apache/linkis/common/utils/ByteTimeUtils.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi91dGlscy9CeXRlVGltZVV0aWxzLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...n/java/org/apache/linkis/common/utils/DESUtil.java](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvbGlua2lzL2NvbW1vbi91dGlscy9ERVNVdGlsLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...ala/org/apache/linkis/common/ServiceInstance.scala](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2xpbmtpcy9jb21tb24vU2VydmljZUluc3RhbmNlLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...scala/org/apache/linkis/common/conf/ByteType.scala](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2xpbmtpcy9jb21tb24vY29uZi9CeXRlVHlwZS5zY2FsYQ==) | `0.00% <0.00%> (ø)` | |
| [...apache/linkis/common/conf/DWCArgumentsParser.scala](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlua2lzLWNvbW1vbnMvbGlua2lzLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2xpbmtpcy9jb21tb24vY29uZi9EV0NBcmd1bWVudHNQYXJzZXIuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| ... and [546 more](https://codecov.io/gh/apache/incubator-linkis/pull/3382/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org
[GitHub] [incubator-linkis] peacewong merged pull request #3382: Merge dev-1.3.0 into master
Posted by GitBox <gi...@apache.org>.
peacewong merged PR #3382:
URL: https://github.com/apache/incubator-linkis/pull/3382
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org