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

API goes down on invalid YAML #153

Closed
jmcarp opened this issue Jun 11, 2015 · 1 comment
Closed

API goes down on invalid YAML #153

jmcarp opened this issue Jun 11, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@jmcarp
Copy link

jmcarp commented Jun 11, 2015

I accidentally set Error Data / API Key Missing to a string that wasn't valid YAML. This seems to have thrown an caught error somewhere, because our entire API went down until I fixed the markup. I would expect the admin interface to refuse any invalid markup to protect careless people like me from themselves.

GUI added a commit to NREL/api-umbrella-gatekeeper that referenced this issue Jun 15, 2015
Related to it being possible to enter invalid error data (but valid
YAML) via the web UI: NREL/api-umbrella#153

In these cases, we will now return the default internal server error,
which at least prevents bad error responses without an HTTP status code
at all, which could really throw some clients for a tizzy.
GUI added a commit to NREL/api-umbrella-web that referenced this issue Jun 15, 2015
This ensures that the error data isn't an unexpected type at the root
like a string: NREL/api-umbrella#153
@GUI
Copy link
Member

GUI commented Jun 15, 2015

Thanks for reporting this and your help tracking it down. As we discussed, the issue was caused if you entered something like foo (without any key value pairs) into the error data YAML field. While we were already validating that the input was valid YAML, we had missed validating whether the parsed YAML was of the expected type (the top-level object must be hash in this case). When an unexpected type, like a top-level string, got entered what happened was that it override the default error variables, which meant when that specific error was being rendered, lot's of weird things may have happened, like the error response being without an HTTP status code (however, the bug should have only impacted the specific error responses and not the overall API).

I was pushing some other updates live, so I went ahead and added some fixes for this:

Thanks again!

@GUI GUI closed this as completed Jun 15, 2015
@GUI GUI added this to the v0.9 milestone Jun 15, 2015
@GUI GUI added the bug label Jun 15, 2015
@GUI GUI self-assigned this Jun 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants