mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-26 07:25:51 +03:00
[GH-ISSUE #986] New type of API key: read-only, but returns check and channel UUIDs #693
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#693
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ThomasKwan-shopline on GitHub (Apr 9, 2024).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/986
Hi, I am using kristofferahl/healthchecksio with terraform to create healthcheck by terraform. I want engineer can self-plan with read-only api key (giving full permission api key is danger), but the read only api key just give limited information. Can healthchecks have a new feature that provide a read-only api key that have a same schema with full permission api key?
Remark
From the response of “List existing checks”, here are the different between both response
@cuu508 commented on GitHub (Apr 10, 2024):
Hello Thomas, can you describe a little more what issue you are hitting with the read-only/full API key schema differences?
The idea with the read-only keys is to not return any data that would allow altering the state of the checks. It is meant to be used in low-trust and no-trust environments, for example, for building status dashboards for unauthenticated users. The read-only responses must not contain check UUIDs, because with the knowledge of the UUID anybody could construct the full ping URL and mess with your monitoring.
@ThomasKwan-shopline commented on GitHub (Apr 11, 2024):
Sure,
As I mention before, we are using terraform with kristofferahl/healthchecksio for healthchecks.io iac which is suggest by healthchecks.io
In our use case, my company will run some custom pipeline for plan and apply terraform. Now only approved engineer can trigger those pipeline since it involve productoin env read-write api key and we dont want other engineer can use this key. However, it make approved engineer always need support other engineer to run the
terraform plan.To solve this problem, we hope to allow other engineer use the read-only api key for terraform plan, because they cannot modify any healthchecks.io resource by using read-only api key. By studying the terraform provider and healthchecks.io doc, I found it is impossible. because It missing two information, uuid and channels.
So we hope to have a new type of api key, that is read-only but have the same schema with read-write api key, so we can just easily to apply the new type api key to terraform and the problem solve.
some poc by using this terraform provider
Before test
Create a healthcheck by using terraform
Run terraform plan with read-write api key
Run terraform plan with read-only api key
@cuu508 commented on GitHub (Apr 22, 2024):
Thanks for the explanation, I think I understand the issue you are facing now. And indeed it looks like a new type of API key would be required here. It's not just a matter of making the schemas of read-write and read-only API responses match.
terraform planneeds to know check and channel UUIDs, but the read-only keys are specifically designed to not return them.I'm currently not planning to work on this. I will reconsider if I see ongoing interest from multiple paying or would-be-paying users.
@DonRichie commented on GitHub (Aug 3, 2024):
I would like to add another use-case. My goal is to retrieve the ping durations and send them to influxdb via python for a nice visualization.
With the read-only key I can't see the UUIDs and am therefore stuck after calling the checks endpoint (https:///api/v3/checks/).
What surprises me is that I can see a field "unique_key", which is not the UUID. This information isn't available anymore when I switch to the read-write key. In my opinion this should be uniform.
By switchting to the read-write key I can't see a field for the UUID either, but now there is an "update_url" for each check, which contains it and can be used to get to the desired pings endpoint (https:///api/v3/checks//pings/).
@cuu508 commented on GitHub (Aug 12, 2024):
@DonRichie,
A separate UUID field will be available in the next release, see https://github.com/healthchecks/healthchecks/issues/1007
unique_key is derived from UUID:
github.com/healthchecks/healthchecks@b859a71920/hc/api/models.py (L373)This is an implementation detail though, and could in theory change in future.