Security
A notification mail is input from the internet. Anybody can send you a mail that looks like a bank's, and part of every real bank mail is text the payer wrote. This page lists what the library protects against, what it leaves to you, and how to report a vulnerability.
What the library checks
- Only the bank's own lines are bank data. Payer-written fields (
Informacia pre prijemcu,Zpráva příjemci,Účel platby,Identifikace,názov protiúčtu,informácia pre príjemcu, references and the others listed in the bank guides) are blanked before the amount, the currency, the accounts and the date are read. A transaction header or an amount typed into a message cannot become a payment, and it cannot choose the bank during detection. - Ambiguity is an error. When two parsers accept the same mail, the facade throws
AmbiguousBankExceptioninstead of picking one. A CardPay key repeated with a different value, a ČSOB mail whose balances do not add up, and a ČSOB transaction with a second balance line are rejected withInvalidEmailFormatException. - No guessing with money. Amounts are integers in minor units.
Moneyrejects ambiguous separators (1.234), extra non-zero fraction digits and values that do not fit in an integer; nothing is rounded. - Quoted history is not a payment. Lines starting with
>are ignored. - The sender narrows detection. With a sender, only parsers whose domains match the sender's host are asked.
What you have to check
- Who sent the mail. The library does not verify DKIM, SPF or DMARC; the From header is just a string. Accept bank notifications only when your mail server's
Authentication-Resultssays DKIM passed for the bank's domain, or receive them on an address only the bank knows. Then pass the sender so detection is limited to that bank. - CardPay and ComfortPay signatures.
signholds theHMAC(orSIGN) value as sent. It is not verified, because the library does not have your gateway key. Verify it with your gateway key the same way you verify the CardPay return URL (for example with omnipay-tatra). - The amount, not only the symbol. The variable symbol can come from a message the payer wrote (Tatra banka
Informacia pre prijemcu, ČSOB CZIdentifikaceandZpráva příjemci, ČSOB SKinformácia pre príjemcu), exactly as in 4.1.0. Pair a payment with an order only when the symbol and the amount match, plus another identifier when you have one. See the mailbox example. - ČSOB mails without balance lines. A mail with several transactions and no balance line is parsed as in 4.1.0. Without the bank's balances, a transaction forged into payer text after a blank line cannot be told apart from a real one. Reconcile such payments with a statement or the bank's API.
- Idempotency. The same payment can arrive twice (a forwarded mail, a re-run job). Book it once, for example by a unique key on the bank's transaction data.
Keys and personal data
- Keep the PGP private key for Tatra banka statements outside the web root and out of the repository, readable only by the process that parses mail; read its path and passphrase from your secret store.
- Bank mails contain account numbers, names and payment messages. Store and log them as personal data under GDPR, and do not put raw mail bodies into error messages that reach users or third-party error trackers. The exception messages of this library do not include the sender address or the mail body (an invalid amount is quoted).
Supported Versions
Security fixes are provided for the lines below.
| Version | Supported |
|---|---|
| 5.x | Yes: bug fixes and security fixes |
| 4.x | Security fixes only, until 2027-04-12 |
| < 4.0 | No |
5.x is the current stable line. 4.x gets fixes for security vulnerabilities only, for six months after the 5.0.0 release (until 2027-04-12); there is no 4.x maintenance branch, so a fix is released from one created from the 4.1.0 tag. Upgrade to 5.x with UPGRADE-5.0.md. Versions older than 4.0 do not receive security updates.
Reporting a Vulnerability
If you discover a security vulnerability in this library, please report it responsibly:
Private Disclosure
DO NOT open a public issue for security vulnerabilities.
The preferred way to report a vulnerability is GitHub Private vulnerability reporting.
As a backup, email security details to: tomasmajer@gmail.com
Include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
Response
You will receive an acknowledgement within 14 days. We then confirm the issue, agree on a disclosure date with you, and keep you informed while the fix is prepared.
Coordinated disclosure
We follow coordinated disclosure. Please give us time to prepare a fix before discussing the issue in public. When the fix is released, we publish a GitHub Security Advisory and record the fix in the CHANGELOG with a **Security**: entry.
Security Best Practices
When using this library:
- PGP Keys: Store PGP private keys outside web root
- Credentials: Use environment variables for sensitive configuration
- Validation: Always validate extracted amounts before processing payments
- Error Messages: Never expose raw email content in error messages
- Logging: Log parsing failures for security monitoring
- Updates: Keep the library and dependencies up to date
Known Security Considerations
Email Content
This library parses email content that may contain:
- Financial transaction data
- Account numbers (IBAN)
- Banking symbols (VS, KS, SS)
Always:
- Validate parsed data before use
- Sanitize output when displaying to users
- Store processed data securely
- Comply with GDPR and local data protection regulations
PGP Decryption
The TatraBankaStatementMailParser decrypts PGP-encrypted emails:
- Ensure private keys are stored securely
- Use strong passphrases
- Rotate keys regularly
- Restrict file system access to key files
Acknowledgments
We appreciate security researchers who responsibly disclose vulnerabilities. Contributors will be acknowledged in release notes (unless they prefer to remain anonymous).