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

encrypt error when sql has CONCAT_WS #32830

Open
yanwencheng opened this issue Sep 10, 2024 · 10 comments
Open

encrypt error when sql has CONCAT_WS #32830

yanwencheng opened this issue Sep 10, 2024 · 10 comments

Comments

@yanwencheng
Copy link

shardingsphere-jdbc-core: 5.3.2
mysql:8.0.24

When I set cipherColumn as name,the select statement contains CONCAT_WS。The decryption method is not performed

@strongduanmu
Copy link
Member

Hi @yanwencheng, can you try the latest 5.5.0?

@yanwencheng
Copy link
Author

yanwencheng commented Sep 10, 2024

Hi @yanwencheng, can you try the latest 5.5.0?

Doesn't look like it's in maven repository
image

@strongduanmu
Copy link
Member

You can search shardingsphere-jdnc.

@yanwencheng
Copy link
Author

yanwencheng commented Sep 10, 2024

You can search shardingsphere-jdnc.

i have try the latest 5.5.0 ,the same issue. and find a new issue if encrypt column is phone ,init select sql

SELECT COUNT(*) FROM (SELECT * FROM t_sys_user WHERE is_deleted = 0 AND id NOT IN (SELECT user_id FROM t_sys_user_role t1 LEFT JOIN t_sys_role t2 ON t1.role_id = t2.id WHERE t2.enname = 'ROLE_ADMIN')) t1 WHERE t1.company_id IN (?, ?, ?, ?, ?)

sharding-sql log error

Cause: java.sql.SQLSyntaxErrorException: Duplicate column name 'phone'

SELECT COUNT(*) FROM (SELECT t_sys_user.`post_ids`, t_sys_user.`dept_id`, t_sys_user.`id`, t_sys_user.`user_name`, t_sys_user.`password`, t_sys_user.`phone` AS `phone`, t_sys_user.`phone`, t_sys_user.`state`, t_sys_user.`real_name` AS `real_name`, t_sys_user.`real_name`, t_sys_user.`type`, t_sys_user.`company_id`, t_sys_user.`company_code`, t_sys_user.`over_time`, t_sys_user.`position_id`, t_sys_user.`creator`, t_sys_user.`create_time`, t_sys_user.`updater`, t_sys_user.`update_time`, t_sys_user.`is_deleted`, t_sys_user.`init_password`, t_sys_user.`password_date` FROM t_sys_user WHERE is_deleted = 0 AND id NOT IN (SELECT user_id FROM t_sys_user_role t1 LEFT JOIN t_sys_role t2 ON t1.role_id = t2.id WHERE t2.enname = 'ROLE_ADMIN')) t1 WHERE t1.company_id IN (?, ?, ?, ?, ?) ::: [1824654233383866370, 1824684768466440194, 1833488354902151170, 1833691625633746946, 1824647647248650242]

@yanwencheng
Copy link
Author

yanwencheng commented Sep 11, 2024

You can search `shardingsphere-jdnc

When using a CASE statement within an SQL SELECT query to conditionally return different encrypted fields such as user_name or phone and aliasing the result, it's possible that the encryption/decryption does not work as expected.

        SELECT
       *,
        CASE
        WHEN user_name IS NOT NULL THEN user_name 
        WHEN phone IS NOT NULL THEN phone 
        END AS companyName
        FROM
        xxxx

@aillamsun
Copy link

You can search shardingsphere-jdnc.

unable to find 5.5.0. do you have an address?

@strongduanmu
Copy link
Member

creator

Can you show your configuration? It looks like your plaintext column and ciphertext column are incorrectly configured with the same name.

@strongduanmu
Copy link
Member

You can search shardingsphere-jdnc.

unable to find 5.5.0. do you have an address?

You can get latest version here——https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-jdbc/5.5.0

@strongduanmu
Copy link
Member

shardingsphere-jdbc-core: 5.3.2 mysql:8.0.24

When I set cipherColumn as name,the select statement contains CONCAT_WS。The decryption method is not performed

Currently ShardingSphere does not support the use of encrypted columns in functions, inluding CONCAT_WS. Let's see if there are community volunteers to improve this feature.

@strongduanmu
Copy link
Member

Duplicate with #32835

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