-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Structured /health Response #4305
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4305 +/- ##
==========================================
+ Coverage 92.51% 92.51% +<.01%
==========================================
Files 118 118
Lines 8251 8256 +5
==========================================
+ Hits 7633 7638 +5
Misses 618 618
Continue to review full report at Codecov.
|
Bleh, finally CI completes.... I want to note that it looks like (beyond seeing a repeat of #4294) I'm seeing some additional arbitrary test failures as follows.
I've been making a personal note of these. At some point I'll start going after them. |
From a security perspective, doesn't this make foot-printing easier? Returning information about the server version on a public unauthenticated request makes it really easy to develop bots that check for a version of Parse Server that is vulnerable to an attack, lowering the cost of effort for a random attacker to locate vulnerable servers. If the Health Check is going to return structured data, I think that's a feature that should be possible to disable for security hardening. I'd prefer to see the health check do more - but still just return OK. Specifically, it would be nice if it did a simple round-trip to the database that does nothing but confirm the database server is up. A more complex implementation could provide an API for plugins to register health check operations so that - for example - the s3 file adapter could check that it's configured s3 bucket exists and that it can write a file and read it back. |
I Like your thinking @nbering |
@flovilmart Thanks. People pay me to think about these things and I can never shut it off. 😊 |
@nbering yes you are correct, it would make it easier for others to run automated scans/attacks. The thought for having the version here is in open consideration that feature detection based on version would be handy later on for the sdks. It could allow variable adjustment of internal functionality, such as whether we can Allowing the health check to incorporate additional information is definitely idea here. Making it structured we would be free to add/remove information from I really like the idea of being able to variably register additional information for the health check. I'm going to go back and see if I can't put something together to move in that direction. Additionally, considering that some of this information may just be too sensitive, perhaps a similar registering system could be implemented over at |
I’m ok to add all of that on serverInfo, we could have a health panel also on the dashboard. Also, it’s quite biased as only 1 server is hit by the dashboard. |
Alright, so going along with what was being discussed I figured this should introduce a basic Health checking system that can have additional data & callbacks registered into what is ultimately reported at Now the implementation isn't really there yet for how the data for the In essence, you can work on it like a ParseObject (roughly). You can interact with it like so. // set one thing
Health.set('report_this', 'running');
// set a bunch of things
Health.setAll({
item1: 'check',
item2: 1
});
// set a callback (can do this in 'setAll' as well)
Health.set('callback', function() {
return 'functional';
});
// get a value from our current health report
Health.get('item1');
// get the result of the callback (not the callback itself)
Health.get('callback');
// get everything! This is what's used to generate the final report as well
Health.getAll();
// alias for above
Health.getReport();
// get the raw value, like the actual Function that is our callback
Health.getRaw('callback');
// clear a value
Health.clear('item1');
// clear all values
Health.clearAll();
// reset to what we started with
Health.reset(); I figure setting it up like this it would not be difficult to register and add additional reporting data directly, or via a callback. If we wanted to add something for health, like an API or exposing a config, we wouldn't have to worry about handling the actual incorporation of the data into the response. All we would have to focus on is providing the data to @flovilmart @nbering if you have a moment let me know what your thoughts are on this. I'm not married to anything in here yet, but I think it's a step in the right direction. May still change the naming of this as well, not sure if |
As an additional note if this seems good I would be willing to work towards applying the same thing for |
ServerInfo is solely used by the dashboard to determine which features it should enable, I don’t believe we should change it. If anything, it should be static, not dynamic. |
Ahh, I didn't realize that...scratch that last note then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@montymxb, I believe it’s overkill, and the endpoint being public, overall, probably insecure. Also, how would one configure the Health exernally? The module is not available.
Also in a distributed environment, I’m not sure how I would call this to monitor the status of my servers, unless i’m At loadbalancer level and have access to all IP’s of each server.
Alright, I'll just scrap this and roll back to the original structured approach. That was the original intent, minus exploring a bit more. |
4b78644
to
3002b25
Compare
@flovilmart rolled back the last commit, back to structured 'status' of 'ok' now 👍 . Doesn't really indicate it very well (doesn't like hard resets I presume), but the change has been made. |
Alright let's go with it! As for health of the dashboard, this goes with particular instrumentation of the different components, perhaps through a health adapter, that would report some values in statsd / prometheus format etc... This would be interesting to explore to provide insights without the usual monkey patching. |
Yeah, I would like to see something like this at some point. Adding reporting into the dashboard would be quite handy. |
* modifies /health to return json instead of OK * version removed!
The current response from
/health
is a simpleOK
. This is pretty straight forward, and is handy for quickly checking if a server is up. However the response from/parse
will also do the same, leading the health check to appear rather extraneous.This PR proposes to return structured data instead of a simple string from
/health
, sending a response that can be parsed by any of the sdks with additional details.The endpoint remains simple, but through this we can not only tell if the server appears to be running but which version of a server is running. I've also observed that certain providers of parse-server (sashido in this case) have already made a similar modification to their
/health
response.Although what they are doing is not expected, I feel we could move to make this standard. Being able to assess a server by
/health
and knowing that you can expect a status and version as JSON is both handy and usable by all the sdks (if needed). With the server moving along, and no guarantee that a provider will be keeping up, this can provide an easier way to check for compatibility without needing the masterKey to check/serverInfo
.As stated above, I should note we already have
/serverInfo
which provides the version in addition to some mostly static configs. In depth details may be better suited there, but I believe adding in the version to health makes sense as well.