Skip to content

WalletContext never reacts to a cross-tab logout, so a wallet stays shown as "connected" and usable in a tab where the user was just signed out from another tab #270

Closed

Description

@chonilius

src/context/AuthContext.tsx and src/context/WalletContext.tsx each subscribe to
their own, independent localStorage key via useCrossTabStorage
(mergefi_token and mergefi_wallet_address respectively). When a user signs out in one
tab, AuthContext's cross-tab handler correctly reacts in every other open tab:

const handleTokenChangedElsewhere = useCallback((newValue: string | null) => {
  if (newValue === null) {
    setUser(null);
    setLoading(false);
  } else { void refresh(); }
}, [refresh]);

WalletContext has no listener for this at all — it only reacts to changes on its own
mergefi_wallet_address key, never to mergefi_token. So after a cross-tab logout, a
second tab correctly shows user: null (via AuthContext) but still shows
address: <the previously connected wallet> (via WalletContext) — the UI in that tab
now presents as "signed out of GitHub, but wallet still connected."

Concretely, src/app/issues/[id]/IssueActions.tsx#handleFund gates purely on wallet
state (address ?? (await connect())), with no check on user at all — so a
just-signed-out (in another tab) visitor can still click "Fund this bounty" and have it
succeed using the wallet address WalletContext never cleared, in a tab that otherwise
looks and behaves as signed-out everywhere else (Navbar shows "Sign in"/"Connect GitHub").

Suggested fix: have WalletContext also react to AuthContext's sign-out (e.g. via
useEffect on user becoming null, or by having AuthContext#logout also call
WalletContext#disconnect) so a cross-tab logout clears the wallet connection too.

Activity

  1. added
    bug
    security
    very hard
    help wanted
    on Aug 21, 2026
  2. added
    Stellar Wave
    on Aug 25, 2026
  3. chikawobishie-sketch commented on Aug 25, 2026

    @chikawobishie-sketch

    @chikawobishie-sketch has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello maintainer, I will love to work on this issues, kindly assign it to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @chikawobishie-sketch to this issue.

  4. MJ-RWA commented on Aug 25, 2026

    @MJ-RWA

    @MJ-RWA has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello MergeFi, can i work on this to implement this fix?
    ETA: 4 hours

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @MJ-RWA to this issue.

  5. SeveentWonder commented on Aug 25, 2026

    @SeveentWonder

    @SeveentWonder has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi there, I’ve carefully reviewed the issue details and I’m confident I can provide a clean, efficient, and maintainable solution.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @SeveentWonder to this issue.

  6. Ukorstack commented on Aug 25, 2026

    @Ukorstack

    @Ukorstack has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    I’m interested in taking this issue and can get started right away. Kindly assign it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Ukorstack to this issue.

  7. Onlyabdull commented on Aug 25, 2026

    @Onlyabdull

    @Onlyabdull has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    I would like to be given this issue to resolve

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Onlyabdull to this issue.

  8. Praxhant97 commented on Aug 25, 2026

    @Praxhant97

    @Praxhant97 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Greetings, I would like to work on your MergeFi/frontend project! Leaving WalletContext decoupled from cross-tab auth state changes creates a dangerous security and UX gap where users who sign out in one tab appear logged out in the navbar (user: null), yet retain an active wallet address in other open tabs—allowing them to successfully execute financial actions like funding bounties (IssueActions.tsx#handleFund) without a valid session; I am highly comfortable with React context architecture, cross-tab synchronization patterns, and managing secure auth-to-wallet lifecycle boundaries.

    This will allow me to seamlessly tie WalletContext to AuthContext state changes (ensuring that when user becomes null or mergefi_token is cleared across tabs, WalletContext automatically triggers a clean disconnect), eliminate the stale wallet state vulnerability, and guarantee consistent session behavior across all open browser tabs within a 12-hour timeframe.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Praxhant97 to this issue.

  9. ijeoma270 commented on Aug 25, 2026

    @ijeoma270
    Contributor

    @ijeoma270 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    hello can i work on this issue please

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @ijeoma270 to this issue.

  10. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @ijeoma270! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @ijeoma270: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  11. grantfox-oss commented on Aug 25, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!

    @ijeoma270's PR #327 was approved and merged by @chonilius.

    🏆 @ijeoma270: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (815 total points). Track your full progress on GrantFox.

    👏 Great work, @ijeoma270! Keep contributing to MergeFi.

  12. added a commit that references this issue on Aug 25, 2026
  13. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @ijeoma270 as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @ijeoma270: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  14. removed
    Stellar Wave
    on Oct 15, 2026
  15. added
    Stellar Wave
    on Oct 15, 2026
  16. removed
    Stellar Wave
    on Oct 15, 2026
  17. added
    Stellar Wave
    on Oct 15, 2026
  18. removed
    Stellar Wave
    on Oct 15, 2026
  19. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar Wavebughelp wantedsecurityvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions