Feature/be payment session validator and exchange rate oracle cache - #1589
Merged
Conversation
…or Payment Session Validator - sanitizeSessionPayload: reject non-object bodies and prototype-pollution keys at any depth; NFC-normalize and strip control, bidi and zero-width characters from string fields; enforce per-field length caps - validateSessionAsset / validateSessionAmount: 1-12 alphanumeric asset codes; positive, finite amounts within int64 stroops and <= 7 decimals - validatePerAssetLimits: own-property lookup only, numeric coercion of bounds; inspectPaymentLimitsConfig reports malformed merchant config - validateAllowedIssuers: ignore non-string allowlist entries - request-schemas: import isValidStellarPublicKey (was a ReferenceError for every non-XLM session with an issuer) - sanitize-metadata: reject __proto__/constructor/prototype keys instead of assigning them onto the sanitized object Closes emdevelopa#1447 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ayment Session Validator - validatePaymentSession(): single instrumented entry point running sanitization -> payload -> issuer -> limits -> allowlist, used by the HTTP route and paymentService (now before the on-chain issuer lookup) - dedicated metrics registry merged into /metrics: evaluations, rejections by rule/reason, latency, sanitized fields, suspicious payloads, merchant config anomalies, rolling health gauges - constant-memory rolling-window health monitor exposed at GET /health/payment-session-validator (503 only when unhealthy) and as an informational field on /health - Prometheus alerting rules with a test guarding against metric drift - structured logging that never includes the raw payload - docs/PAYMENT_SESSION_VALIDATOR.md Closes emdevelopa#1448 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r Exchange Rate Oracle Cache - ExchangeRateCache.getOrLoad(): single-flight loading so concurrent misses for a quote make one Horizon call per process; loader errors reach every waiter and are not cached; bounded load timeout (504) - invalidation-safe writes: delete()/clear() detach in-flight loads so a load that started before invalidation can never write back - ExchangeRateCoordinator: Redis SET NX PX lock with owner tokens and compare-and-delete release, shared quote store, follower polling with leader takeover and wait timeout; fails open to a direct Horizon query - shared entries are validated before use (poisoned/corrupt = miss) - cross-instance invalidation via the shared store - concurrency metrics on the path-payment registry - enabled by createApp() when Redis is connected - fix two tests whose expectations contradicted the behavior they name - docs/EXCHANGE_RATE_ORACLE_CACHE.md Closes emdevelopa#1445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r Exchange Rate Oracle Cache - tests/integration/exchange-rate-cache.test.js: real HTTP stack on GET /api/path-payment-quote/:id — burst coalescing, distinct pairs, 404/502 fan-out without caching, 504 on hung Horizon, invalidation mid-flight, /metrics exposure, Redis coordination, poisoned shared entry, Redis outage - load-tests/exchange-rate-cache-stress.test.js: 5k-20k concurrent requests, LRU churn, invalidation storm, failure isolation, and 8 simulated instances sharing Redis (1 Horizon call per key), lock-holder crash, Redis outage mid-burst, stuck lock, leak checks - CacheLoadTimeoutError now sets `status` so the Express error handler returns 504 instead of 500 (found by the integration suite) - document suites and mutation-check results Closes emdevelopa#1446 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@LawalRahman is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@rahmanabimbs 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1448
Closes #1447
Closes #1446
Closes #1445