-
Notifications
You must be signed in to change notification settings - Fork 11.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
Alerting: Update provisioning to validate user-defined UID on create #73793
Conversation
docs/sources/alerting/set-up/provision-alerting-resources/file-provisioning/index.md
Outdated
Show resolved
Hide resolved
docs/sources/alerting/set-up/provision-alerting-resources/file-provisioning/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
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.
Couple very minor nits around testing, but LGTM 🚀
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.
LGTM, nice approach with making it so only newly created objects uptake this, so it's not breaking.
What's here is good, though I suspect we could go further - check the PUT for contact points:
What happens if you PUT /contact-points/
with:
{
...
"uid": "some-long-invalid-uid"
}
I honestly don't remember the behavior here - does it try to update the actual UID of the contact point? If so, we could potentially also attempt to validate in this case too (as long as we don't break updates if the path UID is already invalid to begin with).
Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
I just tested it and uid in the payload is ignored. Perhaps we need to fail the request if uid is specified. |
…rafana#73793) * add ValidateUID to util * provisioning to validate UID on rule creation --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
…73793) * add ValidateUID to util * provisioning to validate UID on rule creation --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
What is this feature?
Fixes provisioning service to validate user-assigned UID of alert rule and contact points, and return error if the UID does not meet the requirements.
Validation does not affect the update operation and therefore, existing resources will not be affected.
Why do we need this feature?
To enforce uniform rules for UIDs across all APIs and databases. In SQLite mode, the long UID will be accepted because the field has TEXT type. However, in MySQL and Postgres - the UID will be rejected by the database.
Also, it will help prevent users from getting in trouble while using manually assigned UIDs. For example, UID like
my=abc
will be accepted by provisioning but user will not be able to reach out the rule via UI.Who is this feature for?
[Add information on what kind of user the feature is for.]
Which issue(s) does this PR fix?:
Fixes #62904
Special notes for your reviewer:
Please check that: