Skip to content

ipv4 format checker is too lenient #149

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

Closed
exarkun opened this issue Feb 19, 2014 · 2 comments
Closed

ipv4 format checker is too lenient #149

exarkun opened this issue Feb 19, 2014 · 2 comments

Comments

@exarkun
Copy link

exarkun commented Feb 19, 2014

According to http://json-schema.org/latest/json-schema-validation.html#anchor117 the ipv4 format is an IPv4 address according to the "dotted-quad" ABNF syntax as defined in RFC 2673, section 3.2 [RFC2673].

The "dotted-quad" ABNF syntax referenced is:

dotted-quad      =  decbyte "." decbyte "." decbyte "." decbyte
decbyte          =  1*3DIGIT

The draft4_format_checker incorrectly allows the following values which do not conform to this syntax:

  • 127.0
  • 0x7f000001
  • 2130706433
  • 017700000001

Presumably according to the whims of the platform inet_aton implementation.

@Julian
Copy link
Member

Julian commented Feb 19, 2014

Hey,

Yup, thanks, good catch. Guess it's regex time.

Should be fairly simple, I can probably knock it off certainly before the next release. If you had interest yourself, the way to do that is to add a test to https://github.com/json-schema/JSON-Schema-Test-Suite/blob/develop/tests/draft4/optional/format.json#L61-L77 (which is git subtree'd into this repo).

@exarkun
Copy link
Author

exarkun commented Feb 20, 2014

Thanks!

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

2 participants