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

GUID generated by Sql Server doesn't pass validation #4251

Closed
johoye opened this issue Feb 23, 2018 · 3 comments · Fixed by #4252
Closed

GUID generated by Sql Server doesn't pass validation #4251

johoye opened this issue Feb 23, 2018 · 3 comments · Fixed by #4252

Comments

@johoye
Copy link

johoye commented Feb 23, 2018

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.10.0
How did you install Swagger-UI? NuGet
Which browser & version? Chrome 63.0.3239.132
Which operating system? Windows 10

Demonstration API definition

image

Expected Behavior

6ffefd8e-a018-e811-bbf9-60f67727d806 should be recognized as a valid GUID when used as a parameter. This GUID was generated by SQL Server and should regarded as valid.

Current Behavior

The following error is produced: "Value must be a Guid"

Possible Solution

In utils.js in the method validateGuid(val) the RegEx could be changed to allow [0-9a-f] for all characters. Currently there are restrictions to the first character in both of the character-groups 3 and 4

@heldersepu
Copy link
Contributor

Looking into it:

We have regEx to trigger that message

!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}[)}]?$/.test("6ffefd8e-a018-e811-bbf9-60f67727d806")
true
!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}[)}]?$/.test("8f25150a-cc88-455a-852b-27c1a86972e2")
false

@heldersepu
Copy link
Contributor

Here are some details from http://guid.us/

Version one (V1) GUIDs which have a network MAC address embedded and can be recognized by the digit '1' in the third group of digits, for example {644e1dd7-2a7f-18fb-b8ed-ed78c3f92c2b}.

Version four (V4) GUIDs use a different algorithm, which is a random number. Where a '4' is in the same position (third group of digits), for example {20380a3-8777-43f7-a79e-65bdb53f4621}. Because of this pattern if a hacker knows the internal state, it is possible to generate the same GUIDs on another system.

If we strictly follow that your GUID does not comply:
6ffefd8e-a018-e811-bbf9-60f67727d806

But I guess I should allow any possible GUID in the UI and let the backend be more restrictive...

@lock
Copy link

lock bot commented Jul 2, 2019

Locking due to inactivity.

This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.

If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report.

Thanks!

@lock lock bot locked and limited conversation to collaborators Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants