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

Prevent deleting data when non-existing customer #78

Merged
merged 1 commit into from
Apr 2, 2020

Conversation

Matt75
Copy link
Contributor

@Matt75 Matt75 commented Feb 20, 2020

Questions Answers
Description? Prevent deleting data when non-existing customer
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? https://github.com/PrestaShop/psgdpr/issues/77
How to test? For example ps-admin/index.php?controller=AdminAjaxPsgdpr&token=0fdd3c1562cd6e510b7f8f1bc9b35d56&ajax=true&action=DeleteCustomer&delete=customer&value=0 (Do not forget to change token by yours in this example)

Prevent deleting data when non-existing customer, eg. $customer->id = 0

  • All specific price not associated to a customer will be deleted
  • All cart rules not associated to a customer will be deleted
  • All anonymous customer thread and messages will be deleted

Bug reported from Addons

@Quetzacoalt91 Quetzacoalt91 added bug Something isn't working waiting for QA labels Feb 21, 2020
@camlafit
Copy link

Hello

Thank for this PR.

As said these methods are public (also deleteDataFromPrestashop). These methods can be used to create a cron and anonymize old accounts (our use case).
An other case, any ajax call can send an erroneous id_customer.
Other use case on db overload and query partially broken and not secured.

@sarahdib
Copy link

sarahdib commented Apr 2, 2020

@Matt75 in which case the id_customer = 0 ?

@Matt75
Copy link
Contributor Author

Matt75 commented Apr 2, 2020

@sarahdib Problem is only when id_customer = 0 ;)
As said by @camlafit, on cron job or when url is manually changed.

For example ps-admin/index.php?controller=AdminAjaxPsgdpr&token=0fdd3c1562cd6e510b7f8f1bc9b35d56&ajax=true&action=DeleteCustomer&delete=customer&value=0 (Do not forget to change token by yours in this example)

@sarahdib
Copy link

sarahdib commented Apr 2, 2020

@Matt75 yes but I can't reproduce a case with id_customer = 0 in order to test. Do you now when a customer id is 0 ?

@Matt75
Copy link
Contributor Author

Matt75 commented Apr 2, 2020

@sarahdib No need to have a customer id = 0 ... it never happens but if id_customer = 0 is given, gpdr module delete :

  • All specific price not associated to a customer will be deleted
  • All cart rules not associated to a customer will be deleted
  • All anonymous customer thread and messages will be deleted

@sarahdib
Copy link

sarahdib commented Apr 2, 2020

@Matt75 Thanks :)

@Matt75 Matt75 merged commit 1c3947c into PrestaShop:dev Apr 2, 2020
@Matt75 Matt75 deleted the dev branch April 2, 2020 10:52
@camlafit
Copy link

camlafit commented Apr 2, 2020

\o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA ✔️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants