Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBAN Validation fails although data is valid according to XSD #163

Open
DannyvdSluijs opened this issue Nov 25, 2024 · 0 comments
Open

IBAN Validation fails although data is valid according to XSD #163

DannyvdSluijs opened this issue Nov 25, 2024 · 0 comments

Comments

@DannyvdSluijs
Copy link
Contributor

Introduction

The urn:iso:std:iso:20022:tech:xsd:camt.053.001.12 XSD describes the IBAN2007Identifier as follows:

    <xs:simpleType name="IBAN2007Identifier">
        <xs:restriction base="xs:string">
            <xs:pattern value="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}"/>
        </xs:restriction>
    </xs:simpleType>

Problem

Which states that an IBAN is a string valid according to the regex [A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}. This makes that a value like ZZ12345678901234SOMEASCIITEXT is valid according to the XSD. (This exact value didn't occur in a file but the same pattern was observed).

There is a change this is an issue at the banking software, however currently this lib validates the IBAN as being valid when parsing the file. This poses several issues:

  • This library does something beyond what is in the specification
  • Throws an exception while parsing the file when an invalid IBAN is encountered, resulting in an unreadable file

Possible solutions

  • The obvious solution is removing the IBAN validation, but this could have a high impact on other users who might be unaware of such a change.
  • Another option might be to provide context/config in order to indicate if you want to validate the IBAN or if your need is to be willing to accept unvalidated values (and thus possible accept invalid IBAN values)
  • A third option is to make the validation lazy e.g. only validating the IBAN value when invoking getIban or __toString() methods. As this would allow to wrap those methods being invoked in a try-catch block at level where this library is being used.

Before starting to work on a pull request it might be best to pick a solution direction before putting in any effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant