Repository navigation
lib/api: Add /rest/noauth/health health-check (fixes #8430) - #8585
Merged
Merged
Conversation
added 2 commits
October 6, 2022 11:03
Added /rest/status as exception to the CSRF-token requirement and added a simple function to return a simple JSON object. The HTTP status gets send with per default
calmh
reviewed
Oct 6, 2022
calmh
approved these changes
Oct 6, 2022
Member
|
Please do provide an appropriate documentation PR for the API endpoint. We put in quite some work to get caught up and have them all documented, let's try to keep it complete. |
7 of 11 tasks
Member
Author
I will adjust the documentation and file a PR accordingly tomorrow. |
Contributor
|
Our docker healthcheck is now using this endpoint #8640 |
emlun
added a commit
to emlun/syncthing
that referenced
this pull request
Jan 7, 2023
With the no-auth API exception added in commit 7a40240 (PR syncthing#8585), we can extend that with a few more exceptions instead of restructuring the routing muxes and moving the static assets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Added a status page to the REST API which can act as a health-check, this allows third-party services and devices to check the status of Syncthing without having to use an API-key or plain-texted credentials.
To accomplish this two things were adjusted:
And obviously the /rest/status functionality was added, which is a simple return of a JSON object. Since, if you reach that point - it all goes well anyways. If not, you'll get another kind of error before reaching this point.
Testing
Two parts:
1.) Functional; visit the url and call the url in several ways, browser/curl/wget/...
2.) Security: Since we made an exception in the security-layer; hack-and-slash the URL a little to see if we don't unexpectedly reach other pages from this status-page while being unauthenticated.
Documentation
The API documentation will have to be updated to cover this addition.