openid / openid/AppAuth-JS

RedirectRequestHandler leaks storage entries

Open
#208 0 comments 0 reactions 0 assignees View on GitHub

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
  1. Use LocalStorageBackend with a RedirectRequestHandler.
  2. Introduce a misconfiguration into your app that causes the OAuth flow to fail.
  3. Perform repeated login attempts.
  4. 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

Open the contributing guide

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.