Skip to content

feat: liquidation alerting and dry-run, query-performance CI gate, re… - #630

Merged
robertocarlous merged 1 commit into
Neurowealth:mainfrom
coderDom-x:feat/593-594-592-591-liquidation-alerting-query-gate-recurring-idempotency-webhook-ssrf
Oct 20, 2026
Merged

robertocarlous merged 1 commit into
Neurowealth:mainfrom
coderDom-x:feat/593-594-592-591-liquidation-alerting-query-gate-recurring-idempotency-webhook-ssrf

Conversation

@coderDom-x

Copy link
Copy Markdown
Contributor

Summary

This PR resolves four related backend reliability and security issues in one change set.

Closes #593
Closes #594
Closes #592
Closes #591

Changes

#593 Loan liquidation monitor: alerting and dry-run

#594 Prisma query-performance regression gate

  • CI runs npm run profile:hot-queries against a seeded database on migration and route changes.
  • The job fails when a migration removes an index or a query exceeds its timing budget, and the output includes the offending plan diff.
  • Budgets are documented next to the hot queries in docs/PRISMA_QUERY_PERFORMANCE.md.

#592 Recurring withdrawals: idempotency and outbox-only money movement

#591 SSRF protection for outbound webhook URLs

  • All dispatch paths revalidate the URL at send time, with IP pinning to defeat DNS rebinding.
  • Blocked ranges: loopback, RFC1918, link-local, CGNAT, ::1, fc00::/7, and cloud metadata endpoints.
  • Redirects are not followed into blocked ranges, and dangerous ports are blocked.
  • Added adversarial unit tests for redirects and DNS rebinding.
  • Documented in docs/WEBHOOK_SECURITY.md.

Testing

  • npm run lint
  • npm run build
  • npm test (dry-run, exactly-once, outbox structural, SSRF adversarial)
  • npm run profile:hot-queries

Notes

  • New config: LIQUIDATION_DRY_RUN (defaults to off, so existing behavior is unchanged).
  • Includes a migration for the execution window unique constraint.

…curring withdrawal idempotency, webhook SSRF hardening

- liquidation: alerts via alerting service on threshold crossing and liquidation success/failure, LIQUIDATION_DRY_RUN flag, force-liquidate with idempotency key, runbook in docs/LENDING.md
- ci: Prisma hot-query regression gate that fails on removed indexes or blown timing budgets and prints the plan diff
- recurring withdrawals: unique execution window constraint, outbox-only money movement, exactly-once kill-and-retry test, extended outbox structural test
- webhooks: send-time URL revalidation with IP pinning, blocked private/link-local/CGNAT ranges, redirect and port checks, adversarial tests, docs/WEBHOOK_SECURITY.md

Closes Neurowealth#593
Closes Neurowealth#594
Closes Neurowealth#592
Closes Neurowealth#591
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@coderDom-x 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

@robertocarlous
robertocarlous merged commit 8aea55a into Neurowealth:main Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment