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

Optional Argument Validation Fails for ® #151

Open
robmeek opened this issue Apr 18, 2023 · 2 comments
Open

Optional Argument Validation Fails for ® #151

robmeek opened this issue Apr 18, 2023 · 2 comments

Comments

@robmeek
Copy link

robmeek commented Apr 18, 2023

I had another instance of #99, this time with a trader name containing the registered trademark character: ®

I asked ChatGPT for some other characters commonly used in the west which are marked as invalid by the current regex. It came up with:

    Currency symbols: $, €, £, ¥, etc.
    Special characters: @, #, %, *, !, ?, ;, :, etc.
    Quotation marks: ", ', ``, '', etc.
    Brackets: [, ], {, }, <, >
    Other punctuation marks: _, =, ~, ^, , |, etc.

With sincere respect and gratefulness for your work on this library, the VIES service is an open, public sector API which is surely protected from the kinds of naive attacks which the regex is intended to prevent. I think this library could remove this layer of validation. ($vies->validateArgument) I can’t see that it would be irresponsible to do so. Or am I missing something?

@robmeek
Copy link
Author

robmeek commented Apr 18, 2023

Regex fix for ®

^[a-zA-Z0-9\s\.\-,&\+\(\)\/º\pL®]+$

@robmeek
Copy link
Author

robmeek commented Apr 18, 2023

As a workaround for myself going forward I am now “precleaning” these optional arguments – stripping away everything which the regex will not accept as valid before I pass them to this library, e.g.

        $clean = function($s) {
            return preg_replace('/[^\p{L}0-9\s\.\-,&\+\(\)\/º]/u', '', $s);
        };

I think that will work fine for me, perhaps for others too.

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