Repository navigation
Description
Problem
src/context/WalletContext.tsx persists the connected address under WALLET_KEY in localStorage and, per the visible code, ties into useAuth()'s user/refresh. The likely intent (per AuthUser.stellarAddress existing in src/types/index.ts) is that a connected wallet address gets associated with the authenticated user's account server-side. This creates a security-relevant linking operation — associating a Stellar address with a GitHub-authenticated identity, presumably so escrow payouts know where to send funds — that needs to be airtight: the frontend must prove the connecting user actually controls the claimed Stellar address (typically via a signed challenge message, not just "Freighter returned this address so we'll trust it"), otherwise a malicious actor could potentially claim an address they don't control if the backend's linking endpoint trusts the frontend-submitted address without independent proof of ownership.
Why this is hard
- You need to determine whether
mergefi-backend's wallet-linking endpoint already requires a signed-challenge proof of ownership (in which case the frontend's job is to correctly implement the challenge/response flow) or whether it naively trusts an address string from the frontend (in which case this is a backend vulnerability that needs cross-repo coordination, and the frontend fix alone can't fully close the gap — but the frontend should still implement client-side best practice and flag the gap clearly). - If a signed-challenge flow needs to be added, this involves
wallet.ts#signTransaction-adjacent work but for message signing rather than transaction signing — check whether Freighter's API (via@stellar/freighter-api) supports asignMessage-equivalent function distinct fromsignTransaction, since these have different security semantics (signing a transaction has fund-moving consequences; signing an arbitrary message for proof-of-ownership must be clearly scoped so the signed payload can't be replayed as something else, e.g. must include a nonce and domain-binding to prevent a captured signature being reused elsewhere). - Must handle the "wallet address changed" case: if a user disconnects and reconnects with a different Freighter account, does the app silently re-link to the new address (dangerous — could let a compromised or wrong account override a legitimate linked payout address without strong re-authentication), or does it require explicit re-confirmation? This needs a deliberate answer, not default behavior.
- Needs to handle the persisted-but-stale-link case:
WALLET_KEYin localStorage could reflect an address that was linked in a previous session but is no longer the backend's source of truth if the user linked a different address from another device —WalletContext's reconciliation logic (or lack thereof) between localStorage, live Freighter state, and backend-recordedAuthUser.stellarAddressneeds to be audited and fixed to avoid the UI presenting a wallet as "connected" when it's actually not the authoritative linked address.
Scope
- Audit whether wallet-address linking currently includes any proof-of-ownership step; if not, implement a signed-challenge (nonce + domain-bound message, signed via Freighter, verified server-side) flow and clearly document the required backend verification as a cross-repo dependency if not already present.
- Add explicit re-confirmation UX for re-linking when the live Freighter address differs from the backend-recorded
stellarAddress. - Fix
WalletContext's reconciliation logic to treatAuthUser.stellarAddress(backend source of truth) as authoritative over the localStorage-persisted address, syncing/correcting the local value rather than trusting it blindly.
Acceptance criteria
- Linking a wallet requires a signed proof-of-ownership message, not just a reported address.
- Reconnecting with a different Freighter account than the backend's recorded address triggers explicit user confirmation before any re-link action, and never silently overrides the record without it.
WalletContext's displayed connection state always reconciles to the backend's recorded address as authoritative on load.
Activity
abdulwahabmonilola-ctrl commentedon Aug 25, 2026
@abdulwahabmonilola-ctrl has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @abdulwahabmonilola-ctrl to this issue.
tecmalik commentedon Aug 25, 2026
@tecmalik has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @tecmalik to this issue.
Waffiyyi commentedon Aug 25, 2026
@Waffiyyi has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Waffiyyi to this issue.
Max347bot commentedon Aug 25, 2026
@Max347bot has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Max347bot to this issue.
gerani1 commentedon Aug 26, 2026
@gerani1 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @gerani1 to this issue.
drips-wave commentedon Aug 26, 2026
Congratulations, @gerani1! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.
🧑💻 @gerani1: 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 🌊
Require signed ownership proof for wallet linking; add non-color cues…
grantfox-oss commentedon Sep 29, 2026
🎉 This issue has been marked as completed on GrantFox!
@gerani1's PR #575 was approved and merged by @chonilius.
🏆 @gerani1: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (236 total points). Track your full progress on GrantFox.
👏 Great work, @gerani1! Keep contributing to MergeFi.
drips-wave commentedon Sep 29, 2026
This issue has been completed by @gerani1 as part of the Stellar Wave Program's 9th Wave 🥳
😎 @gerani1: 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.