Mask account numbers and IBANs wherever they are shown #4339
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.57) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4339"
general
weight: 0.35
jjmata
<!-- claude-projects-attribution: {"github_login":"gfr-free"} -->
_Requested by User_
Summary
Before: Several providers still showed full bank or brokerage account numbers and IBANs. Setup screens printed them (Indexa Capital, Fio, Interactive Brokers, Trade Republic, Trading 212, Akahu). Questrade, Indexa Capital, Fio, Interactive Brokers, Trade Republic and Trading 212 built them into default account names such as "TFSA (12345678)", so the full number reached account lists, reports, CSV exports, the API and the assistant. Transaction "Additional details" dumped counterparty IBANs and account numbers as raw JSON (Monobank, Fio, Akahu), Akahu wrote the counterparty account into every transaction's notes, and Mercury wrote its
detailsobject (counterparty account and routing numbers, IBAN) into notes as a Ruby hash string.After: Every one of those places shows only the last 4 characters, e.g.
•••5678. Existing account names that still contain the full number are rewritten by a data migration; anything a user wrote around the number is kept.This is the follow-up to the shared
mask_last4helper (#3826). It implements the remaining items of that privacy series (Indexa, Questrade, Monobank) plus the reuse candidates and boundary note from the maintainer's audit comment on #3826, extended by a provider-by-provider audit of all 25 sync integrations.Changes
IdentifierMask(app/models/identifier_mask.rb): one masking rule for helpers and models.ApplicationHelper#mask_last4delegates to it. Sophtron (keeps its stored*1234format) and the Trade Republic connection card (strip spaces, hide values under 4 characters) reuse it with their own options.mask_last4: Enable Banking, Lunch Flow, Indexa Capital, Plaid (incl. the duplicate warning), Akahu, Fio (3 views + settings panel, bank code kept), Interactive Brokers, Trade Republic, Trading 212.IbkrAccount.default_name, also used by the Flex report parser that previously named the record after the bare id), Trade Republic, Trading 212.MaskAccountNumbersInGeneratedAccountNames: replaces the exact full number wherever it appears in a provider record's or linked account's name, and gives an IBKR provider record named after the bare number the default name. Renamed accounts without the number are untouched. It works in batches of 500 provider rows, joined to their linked accounts.IdentifierMask.mask_identifiersmasks every value under identifier-like keys (iban,counter_iban,counter_edrpou,counter_account,other_account,account_number,routingNumber,sort_code,card_number,pan, ...), matched on the key's final words socounter_account_name,counter_account_typeoraccount_number_last_4stay readable. Applies to the raw dump and to SimpleFIN/Plaid structured rows. Fio's<account>/<bank>keeps the bank code.AkahuAccount#masked_account_number(dashes dropped before masking) is used by the setup views; notes keep only the last 4 digits of the counterparty account. Mercury notes only keepdetailswhen it is a plain string.RemoveMercuryRoutingDetailsFromNotes: removes the trailingdetailshash (only when it starts with one of Mercury's details keys) from Mercury notes already stored and keeps the note in front of it. Notes the user edited (locked), or that change while the migration runs, are skipped. The details stay in the raw transactions payload.account_numbercolumn (same value asindexa_capital_account_id, which every lookup already uses) viaignored_columns. The column itself stays, so workers on the previous release can still write it during a rolling deploy; a later release can drop it. The invalid-number error message is masked too.mask_last4("123")is•••123), so the helper is for identifiers only, never for secrets.Deliberately unchanged, as the audit comment recommended: wallet address abbreviations, secret placeholders and the mobile money masker follow their own rules.
Screenshots
Indexa Capital setup (name and number):
!Indexa setup before/after
Transaction "Additional details" (Fio and Monobank counterparty, demo data):
!Additional details before/after
Effects on other processes
Not covered
Tests
IdentifierMask, helper short-input boundary, extras masking (incl. nested values and look-alike keys), generated names per provider, both data migrations, Akahu notes, Mercury notes, IBKR report parser.main: 12469 runs, 0 failures, 0 errors.🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
- Account and financial identifiers are now masked across account selection, setup, provider panels, transaction details, account names, validation messages, and duplicate-connection warnings.
- Masking consistently preserves only the final four characters and handles formatted, nested, and provider-specific identifiers appropriately.
- Structured Mercury routing details are excluded from transaction notes while user-entered notes are preserved.
- Account displays now use the correct masked values across supported providers.
- Existing generated account names are updated to use masked identifiers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->