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

feat: creation de la table de suivi RGPD #892

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

vincentporte
Copy link
Contributor

@vincentporte vincentporte commented Jan 27, 2025

Description

🎸 enregistrer, pour chaque email connu, la date de dernière action, afin de déclencher l'anonymisation des contenus au bout d'un délai défini

Type de changement

🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité).
🚧 technique

Points d'attention

🦺 le champ email est unique, bien que le email dans User ne le soit pas
🦺 la méthode save calcul le hash de l'email
🦺 la méthode soft_delete trace la date de deletion et supprime l'email tout en conservant le hash
🦺 le hash est conservé pour comparaison ultérieure et dénombrement des déletions par jour
🦺 la méthode seen permet de créer ou mettre à jour le suivi d'une adresse email

@vincentporte vincentporte linked an issue Jan 27, 2025 that may be closed by this pull request
@vincentporte vincentporte changed the title 889 archivage creation de la table feat: creation de la table de suivi RGPD Jan 27, 2025
@vincentporte vincentporte added the python Pull requests that update Python code label Jan 27, 2025
@vincentporte vincentporte marked this pull request as ready for review January 27, 2025 13:15
tonial
tonial previously approved these changes Jan 27, 2025
lacommunaute/users/tests/tests_models.py Outdated Show resolved Hide resolved
lacommunaute/users/tests/tests_models.py Outdated Show resolved Hide resolved

@pytest.fixture(name="email_last_seen")
def fixture_email_last_seen(db):
return EmailLastSeenFactory(email=email)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je ne suis pas convaincu par l'utilisation d'une fixture pour remplacer un appel à une factory : je trouve que ça rend moins clair la situation.

lacommunaute/users/models.py Show resolved Hide resolved
@tonial
Copy link

tonial commented Jan 27, 2025

Bon, j'ai voulu juste mettre des commentaires sans approve, mais j'ai cliqué au mauvais endroit.
Globalement à part le test hardcodé, le reste est optionnel ou subjectif :)

@vincentporte vincentporte force-pushed the 889-archivage---creation-de-la-table branch from 0893173 to 0532166 Compare January 28, 2025 16:45

def save(self, *args, **kwargs):
if self.email:
self.email_hash = hashlib.sha256(self.email.encode("utf-8")).hexdigest()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En général, pour éviter les rainbow table, on sale les hash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour éviter de hasher souvent, j’aurais uniquement calculé le hash au moment de la suppression. Hasher n’est pas gratuit. 🤷

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait mettre une contrainte pour avoir soit l'email soit le hash de renseigné

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Archivage - creation de la table
3 participants