You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/06/22 11:59:42 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #2894] Add synchronized for the ciphers of internal security accessor
This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 37c0d4258 [KYUUBI #2894] Add synchronized for the ciphers of internal security accessor
37c0d4258 is described below
commit 37c0d4258c5c05cd31dcdaa4cd44fa0e97f607f8
Author: Fei Wang <fw...@ebay.com>
AuthorDate: Wed Jun 22 19:59:34 2022 +0800
[KYUUBI #2894] Add synchronized for the ciphers of internal security accessor
### _Why are the changes needed?_
The cipher is not thread-safe.
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #2933 from turboFei/cipher_not_thread_safe.
Closes #2894
ea3f79c03 [Fei Wang] not thread safe
Authored-by: Fei Wang <fw...@ebay.com>
Signed-off-by: Fei Wang <fw...@ebay.com>
---
.../kyuubi/service/authentication/InternalSecurityAccessor.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/InternalSecurityAccessor.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/InternalSecurityAccessor.scala
index 3c77634ef..62680e6a6 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/InternalSecurityAccessor.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/InternalSecurityAccessor.scala
@@ -66,11 +66,11 @@ class InternalSecurityAccessor(conf: KyuubiConf, val isServer: Boolean) {
}
}
- private[authentication] def encrypt(value: String): String = {
+ private[authentication] def encrypt(value: String): String = synchronized {
byteArrayToHexString(encryptor.doFinal(value.getBytes))
}
- private[authentication] def decrypt(value: String): String = {
+ private[authentication] def decrypt(value: String): String = synchronized {
new String(decryptor.doFinal(hexStringToByteArray(value)))
}