Skip to content

Create new production release#1265

Merged
ebma merged 6 commits into
mainfrom
staging
Jul 8, 2026
Merged

Create new production release#1265
ebma merged 6 commits into
mainfrom
staging

Conversation

@ebma

@ebma ebma commented Jul 8, 2026

Copy link
Copy Markdown
Member

No description provided.

ebma added 6 commits July 8, 2026 19:27
…was dropped)

Follow-up to #1262. In production the structured provider context added by
mapProviderFailure never appeared in the logs: the app logger (config/logger.ts)
formats only `{ timestamp, level, message, label }` via a printf and discards any
metadata object passed as the second argument. So `logger.error("Error registering
ramp", { ...logContext })` logged only the bare message — we still could not tell
which Avenia call failed (e.g. POST /v2/account/tickets) from the logs.

Add `formatProviderContext(logContext)` which renders the provider/call/status/body as
a message suffix, and append it to the register/update/start error logs. Non-provider
failures get an empty suffix, so their log line is unchanged. The response body stays
truncated to 300 chars and is server-side only (never returned to the caller). Removed
the now-misleading `...logContext` spread into the (dropped) metadata object.

Verified live after the #1262 rollout: register now returns 422 as intended, but the
"Error registering ramp" line carried no provider fields — this restores the "where did
it fail" diagnostic that was the point of the logging half of #1262.

Tests: formatProviderContext unit tests (provider suffix contents + empty for
non-provider). Security spec updated to note the logger drops metadata objects.
Brazilian clients care about the Binance USDT/BRL spot price more than the
official fiat FX rate. Make getUsdToFiatExchangeRate try Binance first for
currencies with a mapped USDT symbol (currently BRL via USDTBRL), then fall
back to fastforex, then CoinGecko.

- Add getBinanceUsdtToFiatRate() hitting the public /api/v3/ticker/price
  endpoint (no API key) and BINANCE_API_URL config (defaults to
  https://api.binance.com).
- Generalize the sanity-band guard (assertFastforexRateWithinSanityBand ->
  assertRateWithinSanityBand) so the Binance rate is checked against the same
  CoinGecko reference and per-currency spread limits as fastforex.
- Add verifyBinanceReachability() run at startup so a geo-block (HTTP 451) or
  outage logs loudly instead of silently degrading to the fiat fallback.
- Update security spec (new binance.md, fastforex.md/README provider order).
- Rewrite the price-priority test suite for the new order + Binance tests.
Address PR review: the provider response body is external input echoed from the
provider's HTTP response, so embedding it verbatim in the log message allowed CR/LF to
split the line or forge a fake log entry (CWE-117), and an ESC could inject terminal
color codes. Add sanitizeProviderBody() to collapse control characters (0x00-0x1F, 0x7F)
to a single space before the (already truncated) body is stored in the log context.

The other embedded fields (provider, endpoint, method, numeric status) are code-defined
constants and need no escaping.

Test: a provider body containing \r\n and an ESC sequence is stripped so neither the
logged body nor the formatted suffix can span multiple lines.
…robe

- getBinanceUsdtToFiatRate now rejects a response whose `symbol` differs from
  the requested one, so a misconfigured BINANCE_API_URL or proxy returning a
  different market can't be accepted as a valid-but-wrong price.
- verifyBinanceReachability is now fire-and-forget at startup so a blocked or
  hanging Binance call (up to the 30s fetch timeout) can't delay boot.
- Add a symbol-mismatch fallback test; update Binance security spec.
…ource

feat(api): use Binance USDT/BRL spot as primary USD<>BRL rate source
…ng-message

fix(api): embed provider error context in ramp log message (metadata was dropped)
@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit e8078e6
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a4e9b09f6c5ec0008bbe14e
😎 Deploy Preview https://deploy-preview-1265--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ebma ebma merged commit eccc7a0 into main Jul 8, 2026
9 of 10 checks passed
@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit e8078e6
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a4e9b09fdf30a000857f89a
😎 Deploy Preview https://deploy-preview-1265--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant