You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by Juan Pan <pa...@apache.org> on 2019/10/12 03:38:31 UTC

回复:关于数据脱敏时更新导致的列错位问题

Hi, this bug has been fixed, please refer to https://github.com/apache/incubator-shardingsphere/issues/3207.


Please communicate with community in English.


 Juan Pan


panjuan@apache.org
Juan Pan(Trista), Apache ShardingSphere


在2019年10月11日 10:44,fu_ding@gzhc365.com<fu...@gzhc365.com> 写道:
在插入数据时,列的加密数据正常,在更新时数据错位。以下是我的配置信息。


xml
<encrypt:data-source id="encryptMasterDataSource" data-source-name="masterDataSource" >
    <encrypt:encrypt-rule>
        <encrypt:tables>
            <encrypt:table name="t_uc_patients">
                <encrypt:column logic-column="name" plain-column="name" cipher-column="name_cipher" encryptor-ref="encryptor_aes" />
                <encrypt:column logic-column="id_no" plain-column="id_no" cipher-column="id_no_cipher" encryptor-ref="encryptor_aes" />
                <encrypt:column logic-column="mobile" plain-column="mobile" cipher-column="mobile_cipher" encryptor-ref="encryptor_aes" />
            </encrypt:table>
        </encrypt:tables>
        <encrypt:encryptors>
            <encrypt:encryptor id="encryptor_aes" type="AES" props-ref="props"/>
        </encrypt:encryptors>
    </encrypt:encrypt-rule>
    <encrypt:props>
        <prop key="query.with.cipher.column">false</prop>
        <prop key="sql.show">true</prop>
    </encrypt:props>
</encrypt:data-source>
加密插入的数据


更新后的数据
列插值出现紊乱


附sql.show:
2019-10-11 10:39:09,300 DEBUG [AbstractBeanFactory.java:251] : Returning cached instance of singleton bean 'facadeInterceptor'
2019-10-11 10:39:09,340 DEBUG [SqlSessionUtils.java:99] : Creating a new SqlSession
2019-10-11 10:39:09,432 DEBUG [SqlSessionUtils.java:150] : SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4d354a3e] was not registered for synchronization because synchronization is not active
2019-10-11 10:39:09,505 DEBUG [DataSourceUtils.java:110] : Fetching JDBC Connection from DataSource
2019-10-11 10:39:09,506 DEBUG [SpringManagedTransaction.java:89] : JDBC Connection [org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.EncryptConnection@5968800d] will not be managed by Spring
2019-10-11 10:39:09,511 DEBUG [BaseJdbcLogger.java:145] : ==>  Preparing: update t_uc_patients SET name = ?, id_no = ?, mobile = ? where id = ? 
2019-10-11 10:39:09,530 DEBUG [BaseJdbcLogger.java:145] : ==> Parameters: 测试Upadate(String), 420202199102016214(String), 1578466211(String), 2589283655476051974(Long)
2019-10-11 10:39:09,939 DEBUG [ClientCnxn.java:742] : Got ping response for sessionid: 0x16cdb285d4254a7 after 1ms
2019-10-11 10:39:10,326 DEBUG [ClientCnxn.java:742] : Got ping response for sessionid: 0x16cdb285d4254a8 after 1ms
2019-10-11 10:39:10,576 DEBUG [ClientCnxn.java:742] : Got ping response for sessionid: 0x16cdb285d4254a9 after 1ms
2019-10-11 10:39:10,639 DEBUG [ClientCnxn.java:742] : Got ping response for sessionid: 0x16cdb285d4254aa after 1ms
2019-10-11 10:39:10,681  INFO [SQLLogger.java:99] : Rule Type: encrypt
2019-10-11 10:39:10,682  INFO [SQLLogger.java:99] : SQL: update t_uc_patients
     SET name = ?, name_cipher = ?,
        id_no = ?, id_no_cipher = ?,
        mobile = ?, mobile_cipher = ? 
    where id = ?
2019-10-11 10:39:10,697 DEBUG [BaseJdbcLogger.java:145] : <==    Updates: 1
2019-10-11 10:39:10,699 DEBUG [SqlSessionUtils.java:193] : Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4d354a3e]
2019-10-11 10:39:10,699 DEBUG [DataSourceUtils.java:327] : Returning JDBC Connection to DataSource
1




请问,该问题应如何处理?




fu_ding@gzhc365.com