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

$ref schemas should not allow referencing non-schema assets #89

Open
honzajavorek opened this issue Apr 13, 2017 · 1 comment
Open

$ref schemas should not allow referencing non-schema assets #89

honzajavorek opened this issue Apr 13, 2017 · 1 comment

Comments

@honzajavorek
Copy link
Contributor

I think it's okay to support referencing external files in Gavel, but we really need to test that it will interpret only valid JSON Schema files, not files like /etc/passwd (would disclose sensitive data), /dev/zero (can eat all memory), etc. People run Dredd on their CIs, we need to prevent any vulnerabilities. Following tests should be added:

  • when referencing external file with valid content, Gavel reads the file and correctly validates according to the schema
  • when referencing external file with (possibly sensitive) plain text content, Gavel refuses to read the file and doesn't disclose the file's contents
  • when referencing huge or infinitely large external file (not sure how to test this on Windows very well), Gavel refuses to read the file and doesn't eat all computer memory or doesn't crash
@artem-zakharchenko
Copy link
Contributor

Current state of Gavel has no tests related to referencing external resources through $ref.

It really sounds like JSON Schema's responsibility of handling external resources security- and memory-wise. Moving this logic to Gavel implies support of how $ref is interpreted in various JSON Schema versions (it's an external API, which is subjected to change). It also feels like Gavel would start to care about more things than just data validation.

If anything, these valid concerns should be addressed in Dredd. I believe we can know of JSON Schema being attached to the API description document, check its $ref resource and conduct aforementioned checks.

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

No branches or pull requests

2 participants