genecommerce / module-encryption-key-manager

Tooling to help generate and invalidate magento encryption keys
GNU Lesser General Public License v3.0
54 stars 14 forks source link

Is it only possible to re-encrypt the "General" customer group ? #60

Closed hgati closed 3 weeks ago

hgati commented 3 weeks ago

Only customers belonging to the "General" customer group were re-encrypted, not all customer. Can it be applied to other customer groups as well ?

image

image

convenient commented 3 weeks ago

https://github.com/genecommerce/module-encryption-key-manager/blob/97ae562a42d03474c725ae39cab56f39cb4be6d3/Console/ReencryptColumn.php#L133-L141

This should grab all rows from the table with a column matching the encrypted data format.

Did you figure out the issue?

hgati commented 3 weeks ago

@convenient I found out that it's not about the customer group, but rather the issue occurs when the value of the rp_token field in the database is stored as NULL. so it doesn't seem to be an issue.

Before

SELECT `cb_customer_entity`.`entity_id`, `cb_customer_entity`.`rp_token` 
FROM `cb_customer_entity` 
ORDER BY entity_id ASC 
LIMIT 10 

image

If print the SQL of the code you provided, it looks like the following:

SELECT `cb_customer_entity`.`entity_id`, `cb_customer_entity`.`rp_token` 
FROM `cb_customer_entity` 
WHERE 
    ((`cb_customer_entity`.`rp_token` LIKE '_:_:____%' OR `cb_customer_entity`.`rp_token` LIKE '__:_:____%')) 
    AND 
    (`cb_customer_entity`.`rp_token` NOT LIKE '1:_:__%')

image