sillsdev / sillsdev/TheCombine

Need token cleanup

Open
#3,922 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backend login/signUp lowpriority maintenance project
Dominant language
TypeScript
Stars
22
Forks
10
Avg merge
2d 2h
Merged PRs (30d)
9

Description

We don't have anything clearing out old password reset or project invite tokens. From https://github.com/sillsdev/TheCombine/pull/3920#pullrequestreview-3099238956:

An issue that should be fixed is to think about how these email tokens are invalidated. Right now a token is only invalidated when it is used and it's still valid. That means if a token is never used, or it's used once it's expired it will never be deleted. Cleaning up a token when it's used but expired is pretty easy, but cleaning up an expired token which you never hear from is a little more difficult. Basically you need a function like CleanupAllExpiredTokens(), and then this function should be call periodically. The simple solution is to call that function somewhere you're already touching tokens, eg when a new token is created also cleanup tokens, or maybe when validating/fetching a token from the db. The downside is that if this function is slow it will directly effect the user experience, it will also likely run far more often than needed. The other solution which I would use is to create an aspnet HostedService and just run an infinite loop which a n day delay which calls CleanupAllExpiredTokens, I'd also make sure it runs that function at startup.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the password-reset and project-invite token creation, validation, and persistence entry points. Review how expired tokens are currently handled, then assess the proposed periodic cleanup or ASP.NET HostedService approach. Done means unused expired tokens are removed, including cleanup at startup and on a recurring schedule.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.