In this article we analyze the main international laws and regulations on cybersecurity and data protection. We also address the legal obligations that companies have in the event of a cyber attack and how user consent should be managed for the processing of their personal data.