Skip to content

Create new production release#1154

Merged
ebma merged 15 commits into
mainfrom
staging
May 20, 2026
Merged

Create new production release#1154
ebma merged 15 commits into
mainfrom
staging

Conversation

@ebma
Copy link
Copy Markdown
Member

@ebma ebma commented May 20, 2026

No description provided.

ebma and others added 15 commits May 20, 2026 13:56
- /kyb/attempt-status now requires Supabase auth (CRITICAL-1: was unauthenticated, leaked KYB attempt data by subAccountId).
- /getUser, /getUserRemainingLimit, /validatePixKey accept partner API key OR Supabase token via requirePartnerOrUserAuth, so SDK partners can reach them during ramp pre-flight.
CRITICAL-2: createSubaccount unconditionally overwrote the TaxId.subAccountId
row on any taxId match, letting an attacker (anonymous or authenticated) hijack
another user's subaccount by reusing their taxId and pointing it at a freshly
created BRLA subaccount they control.

- Look up the existing TaxId row before calling the BRLA API. If it is owned by
  a different userId, or owned by no one while the caller is authenticated,
  reject with 409 instead of overwriting. Overwrite is still allowed when the
  row is in the safe Consulted state (no real subaccount bound yet).
- Surface APIError status codes from handleApiError so the 409 reaches clients.
- Add controller tests covering getAveniaUser query handling and the new
  createSubaccount ownership cases.
The shared BrlaGetUserRequest type no longer carries quoteId, and /brla/getUser
now authenticates via partner key or user token instead of a quote-ownership
check. Update the SDK call sites accordingly so BRL pre-flight KYC validation
works for partner SDK callers without a stale quoteId being appended to the
query string.
Several BRLA endpoints accepted any authenticated (or even anonymous) caller
and operated on taxId/subAccountId without checking that the row belongs to
the caller. That let one Supabase user read or progress another user's KYC.

- getAveniaUser: when authenticated as a Supabase user, reject with 403 if
  the taxId row's userId differs (HIGH-1). Partner SDK callers are unaffected.
- /getUploadUrls: switch to requireAuth and require taxIdRecord.userId to
  match the caller (HIGH-3).
- /newKyc: switch to requireAuth, validate subAccountId, and require the
  bound taxId row's userId to match the caller (HIGH-2).
- /kyb/new-level-1/web-sdk: switch to requireAuth and require
  taxIdRecord.userId to match before initiating KYB (HIGH-4).
- Extend getAveniaUser tests with a cross-user 403 case.
Before this, BRL ramp registration only validated KYC level. Invalid pix keys
and over-limit amounts were only surfaced deep in the phase processor, with
opaque errors.

- Add ApiService.validateBrlPixKey and ApiService.getBrlRemainingLimit, both
  hitting the partner-or-user-authenticated BRLA endpoints.
- registerBrlOfframp now rejects invalid pix destinations up front with
  InvalidPixKeyError.
- Both BRL register flows fetch the quote, look up the user's remaining BRL
  limit for the matching ramp direction, and throw AmountExceedsLimitError
  before any ephemeral generation or ramp registration when the BRL amount
  on the quote exceeds the remaining limit.
- Fix handleApiError split bug: use limit 2 so JSON parsing branch is reachable
- Fix subaccount ownership: allow authenticated users to claim anonymous TaxId records
- Widen createSubaccount response type to BrlaCreateSubaccountResponse | BrlaErrorResponse
- Enforce sandboxEnabled => deploymentEnv === "sandbox" for all environments
- Require partner isActive flag in ownsPartnerRecord ownership check
- Fail-closed on non-finite BRL amount in assertWithinBrlLimit
- Update InvalidPixKeyError message to be pixKey-specific
- Move newKyc validation before 5-second sleep to reject invalid requests early
- Fix misleading "scoped by API key" comment in getAveniaUser

Agent-Logs-Url: https://github.com/pendulum-chain/vortex/sessions/64b0a8ee-18e3-4c9b-a61b-973f3ef3a63b

Co-authored-by: ebma <6690623+ebma@users.noreply.github.com>
Add improvements to API endpoint auth checks
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 6d5f82b
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a0dda1ed468940008bf4915
😎 Deploy Preview https://deploy-preview-1154--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 dbfbe5e into main May 20, 2026
7 of 8 checks passed
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit 6d5f82b
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a0dda1ebde99400082e0575
😎 Deploy Preview https://deploy-preview-1154--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.

2 participants