Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

like-query-encrypt column duplicated #32923

Open
jumanjihu opened this issue Sep 19, 2024 · 1 comment
Open

like-query-encrypt column duplicated #32923

jumanjihu opened this issue Sep 19, 2024 · 1 comment

Comments

@jumanjihu
Copy link

jumanjihu commented Sep 19, 2024

Which version of ShardingSphere did you use?

5.3.2

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

shardingsphere-jdbc-core

Expected behavior

different phone with diferent like query column encrypt value

Actual behavior

some different phone with the same like query column encrypt value, for example:
phone_encrypt |display_name |like_query_phone|phone_encrypt |display_name |like_query_phone|
------------------------+------------------+----------------+------------------------+--------------------+----------------+
+PLjCCgZ4PA67YBhZotDfg==|正三 |08850144551 |gZv1/40nUfiXHaEX6WHepg==|苍溪县李斯高粱酒坊 |08850144551 |
+PLjCCgZ4PA67YBhZotDfg==|正三 |08850144551 |gZv1/40nUfiXHaEX6WHepg==|黎平县鸿鹏氧气销售有限责任公司 |08850144551 |
+PLjCCgZ4PA67YBhZotDfg==|正三 |08850144551 |gZv1/40nUfiXHaEX6WHepg==|苍溪县李斯高粱酒坊 |08850144551 |
+PLjCCgZ4PA67YBhZotDfg==|正三 |08850144551 |gZv1/40nUfiXHaEX6WHepg==|黎平县鸿鹏氧气销售有限责任公司 |08850144551 |

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

sql is just simple “batch insert into xxx” for already existed data, and like query column uses CHAR_DIGEST_LIKE algrithm.

Example codes for reproduce this issue (such as a github link).

java code:
AlgorithmConfiguration likeEncryptor = new AlgorithmConfiguration("CHAR_DIGEST_LIKE", props);
encryptors.put(LIKE_ENCRYPTOR_NAME, likeEncryptor);

new EncryptColumnRuleConfiguration( xxxx,xxx,xxxx....., LIKE_ENCRYPTOR_NAME,.....)

sql code:
phone_encrypt varchar(64) DEFAULT NULL COMMENT '加密手机号',
assisted_query_phone varchar(64) DEFAULT NULL COMMENT '加密手机号查询辅助列',
like_query_phone varchar(64) DEFAULT NULL COMMENT '加密手机号模糊查询辅助列',

mybatis code :

INSERT INTO user_new (

)
VALUES

(
#{item.id,jdbcType=BIGINT},
#{item.userName,jdbcType=VARCHAR},
#{item.realName,jdbcType=VARCHAR},
#{item.displayName,jdbcType=VARCHAR},
#{item.displayCode,jdbcType=VARCHAR},
#{item.phone,jdbcType=VARCHAR},
xxxxxxx

@strongduanmu
Copy link
Member

Hi @jumanjihu, can you format your code and mysql result with markdown, it's hard to read the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants