Skip to content

fix: retirement PII leaks by redacting pending secondary email/name data#38427

Open
ktyagiapphelix2u wants to merge 6 commits into
openedx:masterfrom
ktyagiapphelix2u:ktyagi/secondaryemail
Open

fix: retirement PII leaks by redacting pending secondary email/name data#38427
ktyagiapphelix2u wants to merge 6 commits into
openedx:masterfrom
ktyagiapphelix2u:ktyagi/secondaryemail

Conversation

@ktyagiapphelix2u
Copy link
Copy Markdown
Contributor

@ktyagiapphelix2u ktyagiapphelix2u commented Apr 23, 2026

Summary

This PR updates user retirement and secondary email cleanup flows to redact sensitive secondary email data before deletion.

Changes

Added redaction + delete flow for PendingSecondaryEmailChange
Updated AccountRecovery.retire_recovery_email to redact before delete
Integrated cleanup into retirement/deactivation flows and management commands
Added tests verifying UPDATE occurs before DELETE

Ticket & Reference

https://2u-internal.atlassian.net/browse/BOMS-499

@ktyagiapphelix2u ktyagiapphelix2u marked this pull request as ready for review April 23, 2026 11:29
@ktyagiapphelix2u ktyagiapphelix2u requested a review from a team as a code owner April 23, 2026 11:29
Copy link
Copy Markdown
Contributor

@robrap robrap left a comment

Choose a reason for hiding this comment

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

Thanks. Some comments to get started...

.. pii: Contains new_secondary_email, not currently retired
.. pii: Contains new_secondary_email, redacted in `DeactivateLogoutView`
.. pii_types: email_address
.. pii_retirement: retained
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bmedx: [inform] This doesn't seem like it would have been intentionally retained, so I'm fine with calling this a bug and just fixing. Any objections?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ktyagiapphelix2u: Did you follow up on this in Slack?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Apologies, this slipped my mind. I'm taking care of it now.

Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread common/djangoapps/student/models/user.py
Comment thread openedx/core/djangoapps/user_api/accounts/tests/test_retirement_views.py Outdated
Comment thread common/djangoapps/student/views/management.py Outdated
Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread openedx/core/djangoapps/user_api/accounts/views.py Outdated
Comment thread common/djangoapps/student/tests/test_models.py Outdated
Comment thread openedx/core/djangoapps/user_api/management/tests/test_retire_user.py Outdated
Copy link
Copy Markdown
Contributor

@robrap robrap left a comment

Choose a reason for hiding this comment

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

@ktyagiapphelix2u: I added some top-level comments before starting this review. Please respond to those as well. Thank you.

Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread common/djangoapps/student/models/user.py
Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread common/djangoapps/student/models/user.py Outdated
@ktyagiapphelix2u ktyagiapphelix2u force-pushed the ktyagi/secondaryemail branch from 84d0cf9 to 6320d0b Compare May 12, 2026 11:07
@ktyagiapphelix2u ktyagiapphelix2u force-pushed the ktyagi/secondaryemail branch from db74adc to a14e9a1 Compare June 2, 2026 08:17
@ktyagiapphelix2u ktyagiapphelix2u force-pushed the ktyagi/secondaryemail branch from a14e9a1 to d7a28df Compare June 2, 2026 09:40
Comment thread common/djangoapps/student/models/user.py
Comment thread common/djangoapps/student/models/user.py
Comment thread common/djangoapps/student/models/user.py Outdated
Comment thread openedx/core/djangoapps/user_api/accounts/utils.py
Comment thread openedx/core/djangoapps/user_api/accounts/views.py
Comment thread openedx/core/djangoapps/user_api/accounts/utils.py
Comment thread openedx/core/djangoapps/user_api/management/commands/retire_user.py Outdated
@ktyagiapphelix2u ktyagiapphelix2u force-pushed the ktyagi/secondaryemail branch from f214c6c to a2ce50a Compare June 3, 2026 06:25
@ktyagiapphelix2u ktyagiapphelix2u force-pushed the ktyagi/secondaryemail branch from d1687f6 to 11561c4 Compare June 3, 2026 07:18
Copy link
Copy Markdown
Contributor

@robrap robrap left a comment

Choose a reason for hiding this comment

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

Can you fix the pylint issues and then we can merge? Thanks.

Comment thread openedx/core/djangoapps/user_api/management/tests/test_retire_user.py Outdated
Comment thread openedx/core/djangoapps/user_api/management/tests/test_retire_user.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants