Repository navigation
feat(backend): SEP-0001 retry with backoff; Payment Processor Telemetry sanitization, health and retries - #1605
Conversation
…ized telemetry, health and retries to Payment Processor Retry transient SEP-0001 merchant lookups with full-jitter exponential backoff and answer 503 with Retry-After when they stay down. Route all payment processor metrics through sanitising, allow-listed recorders, add rolling-window health, alert series and rules, and retry idempotent status and verification reads.
|
@Elizabethxxx is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Elizabethxxx 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! 🚀 |
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 38822392 | Triggered | JSON Web Token | 610d086 | backend/src/middleware/x402.test.js | View secret |
| 38865302 | Triggered | Generic High Entropy Secret | 610d086 | backend/src/routes/sep0001.test.js | View secret |
| 38865486 | Triggered | Generic High Entropy Secret | 610d086 | backend/src/lib/websocket-relay-retry.test.js | View secret |
| 38864685 | Triggered | Generic High Entropy Secret | 610d086 | backend/src/lib/exchange-rate-oracle-sanitizer.test.js | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Summary
#1459 SEP-0001 Stellar Info Generator: retry with exponential backoff
GET /.well-known/stellar.tomlis the merchant lookup. It now goes throughfetchMerchantForStellarToml()(src/lib/sep0001-retry.js):random(0, min(max, base * 2^n));SEP0001_RETRY_MAX_ATTEMPTS/_BASE_DELAY_MS/_MAX_DELAY_MS, defaults 3 / 100 / 1000, clamped to at most 5 attempts and 5 s.Retry-After: 5instead of 500, so wallets retry rather than treating the domain as having no stellar.toml;Cache-Control: no-store;sep0001_merchant_lookup_retries_total{result}on/metrics.src/lib/sep0001-retry.test.js, newsrc/routes/sep0001.test.js(recover, 503, 500, 404, 400, no error-text leak), plus the app-level cases in the integration suite.SEP0001_GENERATOR_GUIDE.md.#1477 Payment Processor Telemetry: payload sanitization and strict validation
routes/payments.jsandservices/paymentService.jspreviously putreq.body.assetstraight into Prometheus labels, so a client could create a new series per request (unbounded memory here and in Prometheus) or inject text into dashboards.src/lib/payment-processor-telemetry.js:outcome/stage/operationare checked against fixed allow-lists;assetis normalised to^[A-Z0-9]{1,12}$(nativebecomesXLM; malformed codes becomeinvalid; missing becomesunknown);PAYMENT_PROCESSOR_TELEMETRY_MAX_ASSET_LABELS(default 50), with overflow recorded asother;payment_processor_telemetry_rejected_total{metric,reason}and log one warning. Recorders never throw.src/lib/payment-processor-telemetry.test.js(sanitizer table, cardinality cap under a 500-asset flood, every rejection path, a recorder that must not throw).#1478 Payment Processor Telemetry: Prometheus alert metrics and health
payment_processor_health_stateand the four ratio gauges.GET /health/payment-processor(503 only when unhealthy).GET /healthlistsservices.payment_processorfor information only. The body holds counts and ratios only.docs/alerts/payment-processor.rules.yml.#1479 Payment Processor Telemetry: retry with exponential backoff
status_lookup,verify_lookup, in both the route and the service) is retried throughretryProcessorRead()(src/lib/payment-processor-retry.js):PAYMENT_PROCESSOR_RETRY_*, defaults 3 / 50 / 500, clamped to at most 5 attempts and 3 s.{ data, error }comes back unchanged, so response codes are unchanged.payment_processor_retries_total{operation,result}; exhausted retries degrade health.src/lib/backoff-retry.js(retryWithBackoff,retrySupabaseRead) is also used by SEP-0001. It reuses the existingisRetryableSessionErrorclassifier andcomputeBackoffDelay.src/lib/payment-processor-retry.test.js,src/lib/backoff-retry.test.js.Test output
Security notes
no-store, so a CDN cannot cache a failure for the hour that successful responses are cached.Notes
Retry-After(was 500) when a transient lookup outage outlasts the retries.invalid, overflow becomesother; payloads with unknown outcomes are dropped and counted as rejected.payment-processor-metrics.jsexports and series names are unchanged, and the existing metrics, e2e and SEP-0001 tests keep their expectations. No existing tests or fixtures were changed.closes #1459
closes #1477
closes #1478
closes #1479