You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/05/24 02:51:40 UTC
[GitHub] [shardingsphere] tuichenchuxin commented on a diff in pull request #17603: Support encrypt config queryWithCipherColumn with column levels
tuichenchuxin commented on code in PR #17603:
URL: https://github.com/apache/shardingsphere/pull/17603#discussion_r880010657
##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java:
##########
@@ -143,12 +143,34 @@ public void assertFindPlainColumn() {
@Test
public void assertIsQueryWithCipherColumn() {
- EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor");
- EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), true);
+ // global(true) -> table(null) -> column(null)
Review Comment:
This comment need to be removed
##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java:
##########
@@ -143,12 +143,34 @@ public void assertFindPlainColumn() {
@Test
public void assertIsQueryWithCipherColumn() {
- EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor");
- EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), true);
+ // global(true) -> table(null) -> column(null)
+ EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", null);
+ EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), null);
AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(
Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
EncryptRule actual = new EncryptRule(ruleConfig, Collections.emptyMap());
- assertTrue(actual.isQueryWithCipherColumn("t_encrypt"));
+ assertTrue(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
+
+ // global(true) -> table(false) -> column(null)
+ encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", null);
+ tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), false);
+ ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
+ actual = new EncryptRule(ruleConfig, Collections.emptyMap());
+ assertFalse(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
+
+ // global(true) -> table(false) -> column(true)
+ encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", true);
+ tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), false);
+ ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
+ actual = new EncryptRule(ruleConfig, Collections.emptyMap());
+ assertTrue(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
+
+ // global(true) -> table(null) -> column(false)
Review Comment:
This comment need to be removed
##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java:
##########
@@ -143,12 +143,34 @@ public void assertFindPlainColumn() {
@Test
public void assertIsQueryWithCipherColumn() {
- EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor");
- EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), true);
+ // global(true) -> table(null) -> column(null)
+ EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", null);
+ EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), null);
AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(
Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
EncryptRule actual = new EncryptRule(ruleConfig, Collections.emptyMap());
- assertTrue(actual.isQueryWithCipherColumn("t_encrypt"));
+ assertTrue(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
+
+ // global(true) -> table(false) -> column(null)
Review Comment:
This comment need to be removed
##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java:
##########
@@ -143,12 +143,34 @@ public void assertFindPlainColumn() {
@Test
public void assertIsQueryWithCipherColumn() {
- EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor");
- EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), true);
+ // global(true) -> table(null) -> column(null)
+ EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", null);
+ EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), null);
AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(
Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
EncryptRule actual = new EncryptRule(ruleConfig, Collections.emptyMap());
- assertTrue(actual.isQueryWithCipherColumn("t_encrypt"));
+ assertTrue(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
+
+ // global(true) -> table(false) -> column(null)
+ encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", null);
+ tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), false);
+ ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
+ actual = new EncryptRule(ruleConfig, Collections.emptyMap());
+ assertFalse(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
+
+ // global(true) -> table(false) -> column(true)
Review Comment:
This comment need to be removed
--
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@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org