Repository navigation
Scope Avenia Pix key lookups to the user's sub-account and keep Pix keys out of logs - #1477
Merged
Merged
Conversation
Every other value this client puts into an Avenia query string is encoded; the Pix key was not, so characters such as the leading `+` of a phone key did not reach Avenia as typed.
✅ Deploy Preview for vortexfi canceled.
|
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vrtx-dashboard canceled.
|
The offramp recipient check logged the Pix key when Avenia's lookup failed and the receiver's full tax ID on a mismatch, and the unhandled-payment worker logged a tax ID on error. The observability spec forbids both. The warnings now name only the failed check, and the worker names the affected ramp IDs.
Avenia charges each pix-info DICT lookup to the sub-account named by subAccountId, or to the main account when none is given. The optional parameter lets callers that act for a user charge that user's quota.
The offramp recipient check looked Pix keys up on Vortex's main Avenia account, so every registration shared one DICT quota with every other main-account lookup. It now passes the user's subAccountId, which the check already resolves, so each user's lookups draw on their own sub-account's quota.
ebma
force-pushed
the
fix/pix-key-check-limits
branch
from
November 23, 2026 09:49
0313909 to
160cb83
Compare
validateAveniaOfframpRecipient turned every failed lookup into "Invalid pixKey or receiverTaxId.", so a valid key was reported as invalid during a provider outage. Only Avenia's 400 is about the key. A quota limit now returns the temporary provider failure (502), and other provider errors reach the register route's existing provider-failure mapping.
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.
Summary
Changes to how the API asks Avenia to resolve Pix keys (
GET /v2/account/bank-accounts/brl/pix-info):fix(shared)):BrlaApiService.validatePixKeywas the only method in the client that put a caller's value into an Avenia query string withoutencodeURIComponent. Characters such as the leading+of a phone key now reach Avenia as typed.feat(shared),fix(api)):subAccountId, and to the main account when none is given. Each account and sub-account has its own token bucket (Avenia integration guide, "Bank Accounts → DICT lookup limits").validatePixKeytakes an optionalsubAccountId. The offramp recipient check (validateAveniaOfframpRecipient) passes the user's sub-account, which it already resolves, so each registration draws on that user's own quota.subAccountIdis accepted and charged to that sub-account's bucket, independently of the main account's.GET /v1/brl/validatePixKeyis unchanged and still uses the main account.fix(api)):400 "Invalid pixKey or receiverTaxId."for every failed lookup, so a valid key was reported as invalid during a provider outage. Only Avenia's 400 is about the key.502 "The payment provider is temporarily unavailable. Please try again shortly.". Other provider errors reachmapProviderFailurein the ramp controller unchanged: 502 for a 5xx or a timeout, 422 for another 4xx.fix(api)):docs/security-spec/07-operations/client-observability.md§4 forbids both.The security spec (
05-integrations/brla.md, invariant 16) now records the sub-account-scoped lookup.An earlier revision of this PR also added a per-IP limit on the pre-flight route. It was dropped, and the branch history rewritten without it, in favour of scoping the registration lookup. App traffic reaches the API through shared proxy addresses, so a per-IP limit would have pooled unrelated users.
Compatibility
POST /v1/ramp/register: a Pix lookup that fails for a reason other than the key now answers 502 or 422 with the existing provider-failure messages, where it used to answer400 "Invalid pixKey or receiverTaxId.". A bad key or an owner mismatch still answers that 400. The SDK throws aVortexSdkErrorwith that status, and the Stocks app already translates both messages.BrlaApiService.validatePixKey(pixKey, subAccountId?)gains an optional parameter, so existing callers are unaffected. The SDK doesn't use this class.Testing
brlaApiService.test.ts:&subAccountId=and#can't override it.avenia-registration.test.ts:(pixKey, "subaccount-1").wire-contract:checkall pass.