Skip to content

fix(wallet): authenticate wallet data and remove simulated production balances #16

Description

@Joaco2603

Pre-flight checks

  • I searched Backend issues for wallet identity, simulated balances, credits, and payment adapters.
  • This is a production-safety bug, not a request to add more payment providers.

Priority

P0 — the current API exposes user-selected identity and simulated money-like state.

Problem

/api/wallet/balance, /transactions, and /purchase accept the wallet identity through a user query parameter or fall back to anon-placeholder. Package purchase mutates database credits using a simulated XLM balance, while Stripe and PayPal adapters return fabricated success responses when configured. This must not be reachable in a market deployment.

Proposed solution

  1. Require JWT authentication and derive the wallet from the authenticated principal for all private wallet data/mutations.
  2. Remove the user query parameter and anonymous fallback.
  3. Put simulated credits, balances, and payment adapters behind an explicit development/test-only boundary that fails closed in staging/production.
  4. Until the Market V1 economy ADR is approved, either expose verified on-chain/indexed balances or disable the unsupported credit-package flow with an explicit capability response.
  5. Record auditable, idempotent ledger references for any future balance mutation.

Acceptance criteria

  • One user cannot read or mutate another wallet by changing request parameters.
  • Unauthenticated wallet balance, history, and purchase requests return 401.
  • Staging/production cannot boot with simulated payment success enabled.
  • No fabricated XLM/USD value or transaction ID is presented as real money activity.
  • UI can detect that credit packages are unsupported and hide the action safely.
  • Authorization and environment fail-closed behavior have integration tests.

Non-goals

  • Selecting the final settlement asset or payout policy; that belongs to the economy ADR.
  • Adding another mock provider.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignbugSomething isn't workingstatus:approvedApproved for implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions