Skip to content

fix(backend): address transaction fraud, OOM sort, TOML passphrase, a… - #892

Merged
OlaGreat merged 1 commit into
OlaGreat:mainfrom
flavor365:fix/backend-issues-787-788-790-794
Jul 25, 2026
Merged

fix(backend): address transaction fraud, OOM sort, TOML passphrase, a…#892
OlaGreat merged 1 commit into
OlaGreat:mainfrom
flavor365:fix/backend-issues-787-788-790-794

Conversation

@flavor365

Copy link
Copy Markdown
Contributor

…nd Sentry source maps

Closes #794 — POST /support-transactions: recipientAddress ↔ walletAddress assertion Before this fix, the endpoint verified the Horizon transaction was real but never checked that the supplied recipientAddress matched the profile's stored walletAddress. An attacker could pay their own wallet, then POST with a victim's profileId; Horizon verification would pass and the victim's profile would accumulate fraudulent records, milestone progress, badge triggers, and webhook deliveries without ever receiving funds. Fix: after the existing profile-existence check, the query now also selects walletAddress and returns 400 ADDRESS_MISMATCH if it does not equal parsed.data.recipientAddress.

Closes #790 — GET /profiles?sort=most_supported|most_transactions: cap in-memory load The sort-by-metrics branch fetched every profile with every SUCCESS transaction into Node.js memory before sorting and discarding all but the requested page — a DoS and OOM vector at scale (1 M+ rows with 10 k profiles × 100 txs each). Fix: add take: 1000 to the Prisma query to bound the worst-case memory footprint. Comment notes the long-term solution is a precomputed totalSupported/transactionCount column updated transactionally.

Closes #788 — stellar.toml NETWORK_PASSPHRASE always emitted testnet value on mainnet The ternary compared process.env.STELLAR_NETWORK === 'MAINNET', but the actual mainnet value of that variable is 'PUBLIC'. The condition was always false in production, so /.well-known/stellar.toml always advertised the testnet passphrase. Stellar wallets and federation resolvers reading this TOML would fail to build valid mainnet transactions. Fix: change the comparison to === 'PUBLIC'.

Closes #787 — CI: upload Sentry source maps after build for actionable production traces TypeScript is compiled to dist/.js; without source maps uploaded to Sentry, production error traces point to minified/compiled line numbers rather than original src/.ts lines. Fix: enable sourceMap: true in backend/tsconfig.json so the build emits .js.map files, then add a 'Upload source maps to Sentry' step to .github/workflows/backend.yml that runs only on pushes to main using npx @sentry/cli. Requires SENTRY_AUTH_TOKEN to be added to GitHub Actions secrets.

…nd Sentry source maps

Closes OlaGreat#794 — POST /support-transactions: recipientAddress ↔ walletAddress assertion
Before this fix, the endpoint verified the Horizon transaction was real but never
checked that the supplied recipientAddress matched the profile's stored walletAddress.
An attacker could pay their own wallet, then POST with a victim's profileId; Horizon
verification would pass and the victim's profile would accumulate fraudulent records,
milestone progress, badge triggers, and webhook deliveries without ever receiving funds.
Fix: after the existing profile-existence check, the query now also selects walletAddress
and returns 400 ADDRESS_MISMATCH if it does not equal parsed.data.recipientAddress.

Closes OlaGreat#790 — GET /profiles?sort=most_supported|most_transactions: cap in-memory load
The sort-by-metrics branch fetched every profile with every SUCCESS transaction into
Node.js memory before sorting and discarding all but the requested page — a DoS and
OOM vector at scale (1 M+ rows with 10 k profiles × 100 txs each). Fix: add take: 1000
to the Prisma query to bound the worst-case memory footprint. Comment notes the long-term
solution is a precomputed totalSupported/transactionCount column updated transactionally.

Closes OlaGreat#788 — stellar.toml NETWORK_PASSPHRASE always emitted testnet value on mainnet
The ternary compared process.env.STELLAR_NETWORK === 'MAINNET', but the actual mainnet
value of that variable is 'PUBLIC'. The condition was always false in production, so
/.well-known/stellar.toml always advertised the testnet passphrase. Stellar wallets and
federation resolvers reading this TOML would fail to build valid mainnet transactions.
Fix: change the comparison to === 'PUBLIC'.

Closes OlaGreat#787 — CI: upload Sentry source maps after build for actionable production traces
TypeScript is compiled to dist/*.js; without source maps uploaded to Sentry, production
error traces point to minified/compiled line numbers rather than original src/*.ts lines.
Fix: enable sourceMap: true in backend/tsconfig.json so the build emits .js.map files,
then add a 'Upload source maps to Sentry' step to .github/workflows/backend.yml that
runs only on pushes to main using npx @sentry/cli. Requires SENTRY_AUTH_TOKEN to be
added to GitHub Actions secrets.
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@flavor365 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@OlaGreat
OlaGreat merged commit 84df06c into OlaGreat:main Jul 25, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment