Skip to content

Conversation

@jimchamp
Copy link
Collaborator

Adds a script that finds and removes any account-email store entries that were not deleted during our account anonymization process. The script does the following:

  1. Fetches all /people/{username} /type/delete entries from the store, extracting username.
  2. For each username, we check if the associated account has been deactivated by querying store
  3. If the account was deactivated, we search for its account-email store key
  4. Deletes the account-email store entry if a store key was found

Technical

Testing

Screenshot

Stakeholders

jimchamp added 2 commits July 23, 2025 16:12
Running the script with a `--test` flag will print the
keys of affected rows, but not delete any data.
@jimchamp jimchamp force-pushed the account-email-remediation-script branch from 0f8728c to b9e63f6 Compare July 23, 2025 23:15
oldb = db.get_db()

query = """
SELECT SUBSTRING(key FROM 9) as username from thing
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SUBSTRING(key FROM 9) removes the leading "/people/" string from the key.

SELECT SUBSTRING(key FROM 9) as username from thing
WHERE type IN (SELECT id FROM thing WHERE key = '/type/delete' LIMIT 1)
AND key LIKE '/people/%'
AND LENGTH(key) - LENGTH(REPLACE(key, '/', '')) = 2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
AND LENGTH(key) - LENGTH(REPLACE(key, '/', '')) = 2
AND LENGTH(key) - LENGTH(REPLACE(key, '/', '')) = 2

This checks that the key only contains two / characters. We do this to avoid fetching lists, preferences, and other pages.

@mekarpeles mekarpeles merged commit 2de9e7d into internetarchive:master Jul 24, 2025
3 checks passed
@jimchamp jimchamp deleted the account-email-remediation-script branch September 19, 2025 21:11
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.

2 participants