r/SideProject • • 21m ago

Deterministic 3-way invoice & Red-Team gate in Python/FastAPI (Decimal + IBAN MOD-97 + SHA-256 SQLite WAL ledger in 0.40 ms)

Enable HLS to view with audio, or disable this notification

Built a deterministic FastAPI validation layer to sit in front of ERPs and accounting pipelines when ingesting noisy OCR PDFs and Facturae/UBL XML invoices.

In the 20s walkthrough:

  • **PASS:** Clean 3-way PO/GRN/Invoice match with valid IBAN MOD-97 checksum (pure Python Decimal, zero float drift).
  • **REVIEW:** OCR variance (+EUR 75.00 vs PO) or invalid IBAN checksum quarantined before any ERP write.
  • **BLOCKED:** SQLi / SSRF webhook payloads stopped (122/122 Red-Team payloads blocked in CI) and sealed into a SHA-256 chained SQLite WAL ledger tested at 50 concurrent threads with 0 lock errors.

Zero float drift. Zero ERP corruption.

Happy to share implementation details on the WAL locking pattern or Decimal parser if useful.

1 Upvotes

0 comments sorted by