RedirectRequestHandler leaks storage entries
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 165
- PR merge metrics
- No merged PRs in 30d
Description
Expected Behavior
[REQUIRED] Describe expected behavior
When using RedirectRequestHandler, at the conclusion of an OAuth flow, all storage entries should be cleaned up, even if an error occurred.
Describe the problem
[REQUIRED] Actual Behavior
If there was an error during the OAuth flow, storage entries are left behind. This is problematic because a new random value is used as part of the localStorage keys for each new OAuth flow, so not cleaning them up causes localStorage to grow monotonically. This issue was discovered when a user hit the 5MB limit of their localStorage and was no longer able to log into the app, and we found the localStorage filled with many many appauth entries from failed login attempts that happened while the client setup was misconfigured.
This TODO indicates the missing logic.
[REQUIRED] Steps to reproduce the behavior
- Use
LocalStorageBackendwith aRedirectRequestHandler. - Introduce a misconfiguration into your app that causes the OAuth flow to fail.
- Perform repeated login attempts.
- Inspect localStorage in the browser and notice many different appauth keys.
[REQUIRED] Environment
- AppAuth-JS version: 1.3.1
- AppAuth-JS Environment (Node, Browser (UserAgent), ...): Chrome 100
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TODO in src/redirect_based_handler.ts around line 86 and inspect how RedirectRequestHandler uses LocalStorageBackend during failed OAuth flows. Reproduce repeated failed login attempts, then verify that all appauth storage entries are removed when the flow concludes with an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100