Skip to content

fix(sanitizer): redact IBAN bank account numbers (TSK-009) - #108

Merged
jmlweb merged 1 commit into
mainfrom
hustle/maintainer/task-2026-11-22
Nov 22, 2026
Merged

jmlweb merged 1 commit into
mainfrom
hustle/maintainer/task-2026-11-22

Conversation

@jmlweb

@jmlweb jmlweb commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Summary

sanitize had no rule for bank account numbers, so IBANs in prompts, commands or tool output reached the Report unredacted, even though docs/SPECS.md says personal identifiers are redacted (RPT-009 / TSK-009).

What changed

  • src/core/sanitizer.ts: new redactIBANs + passesIbanChecksum.
    • Pattern: 2 uppercase letters, 2 check digits, then 2–7 groups of 4 alphanumerics and an optional 1–4 tail, with an optional single space between groups. This covers compact and grouped-in-fours IBANs.
    • A candidate becomes [REDACTED_IBAN] only when it is 15–34 characters long and the ISO 13616 mod-97 checksum equals 1. Letters map to 10–35 and the remainder is folded digit by digit, so no BigInt is needed. Uppercase reference codes that fail the checksum stay readable.
    • It runs in the pipeline right after redactEmails, before cards, document numbers, national IDs, SSN and phone rules. Without that order, those rules could take some of the grouped digits.
  • src/core/sanitizer.test.ts: new IBAN bank account numbers block with 7 cases.
  • docs/SPECS.md: the sanitization section now lists IBANs and says they are redacted only when the checksum holds.
  • .backlog/: TSK-009 moved to complete with evidence, plus learning LRN-008.

Acceptance criteria

  1. Compact IBANs are redacted (ES9121000418450200051332, GB82WEST12345698765432). Evidence: pnpm vitest run src/core/sanitizer.test.ts -t IBAN asserts the exact output Transfer to [REDACTED_IBAN] today with redacted === 1. These tests failed before the change and pass now.
  2. IBANs grouped in fours with spaces are redacted (ES91 2100 0418 4502 0005 1332, DE89 3704 0044 0532 0130 00). Evidence: the same run asserts IBAN: [REDACTED_IBAN]., so the trailing period is kept and nothing is left over. These tests also failed before and pass now.
  3. Candidates that fail mod-97 are left untouched (ES9221000418450200051332, GB83WEST12345698765432, DE89 3704 0044 0532 0130 01). Evidence: tests assert that no [REDACTED_IBAN] appears for them.
  4. Tests are in src/core/sanitizer.test.ts, and pnpm check && pnpm test pass. Evidence: pnpm check exits 0 (tsc, eslint, prettier). pnpm test passes 26 files / 489 tests. pnpm build succeeds.

Verification

Run locally on Node 22 (the version in .nvmrc):

pnpm check   # exit 0
pnpm test    # 26 files, 489 tests passed
pnpm build   # success

🤖 Generated with Claude Code

Add an IBAN redactor that matches compact and space-grouped IBANs and
redacts them as [REDACTED_IBAN] only when the ISO 13616 mod-97 checksum
holds. It runs right after emails, before card, document, phone and SSN
rules, so grouped digits are not partially consumed. Document IBANs in
the SPECS sanitization section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jmlweb

jmlweb commented Nov 22, 2026

Copy link
Copy Markdown
Owner Author

🤖 hustle review: approve — IBAN redactor regex and mod-97 checksum are correct, pipeline order matches the task, all four acceptance criteria are covered by tests, and docs and backlog are updated consistently.

@jmlweb
jmlweb merged commit e44ae25 into main Nov 22, 2026
8 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 22, 2026
## [4.1.7](v4.1.6...v4.1.7) (2026-11-22)

### Bug Fixes

* **sanitizer:** redact IBAN bank account numbers (TSK-009) ([#108](#108)) ([e44ae25](e44ae25))
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.1.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant