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

Change to KEYWORD_NAME regex to add colon actually allows many characters #1441

Closed
teq0 opened this issue Feb 13, 2021 · 0 comments
Closed

Comments

@teq0
Copy link
Contributor

teq0 commented Feb 13, 2021

#1425 was intended to add ':' to the list of characters allowed in keyword names. Because of the placement of the colon in the regex, after a hyphen, it actually has the effect of allowing all characters from '$' to ':', which includes things like comma, single quote and asterisk.

The fix would be to change the regex at https://github.com/ajv-validator/ajv/blob/master/lib/core.ts#L745 from

^[a-z_$][a-z0-9_$-:]*$

to

^[a-z_$][a-z0-9_$:-]*$

What version of Ajv are you using? Does the issue happen if you use the latest version?
7.1.0

Ajv options object

{}

JSON Schema

Sample data

Your code

Validation result, data AFTER validation, error messages

What results did you expect?

Are you going to resolve the issue?

Yes.

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

No branches or pull requests

2 participants