-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix: do not allow dots in destination names #3382
Conversation
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.
Can we add a migration to this change to check the database for destinations with dots in their names and smoothly update them?
036930e
to
ba88101
Compare
Unfortunately I don't think that migration will make it a smooth update. It will fix the destination name, but if a connector is running for that destination the connector will attempt to update to use the old destination name and start failing. It also doesn't address the grants, which all need to be updated for the new name. The upgrade path for a user with dots in their destination name would be:
The migration for the destination name will remove the last step at least, so I'll add it to this PR. |
Added a migration to replace dots with underscores |
ffda984
to
345848a
Compare
A dot in a destination name makes all grants for that destination ambiguous. They could refer to multiple destinations.
345848a
to
cec7782
Compare
name string | ||
} | ||
|
||
rows, err := tx.Query(`SELECT id, name FROM destinations WHERE name LIKE '%.%'`) |
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.
I realize now I probably could have done this in a single update statement with the postgres replace
function (https://www.postgresql.org/docs/current/functions-string.html), but I think this is fine. I'll try to remember that option for next time.
A dot in a destination name makes all grants for that destination ambiguous. They could refer to multiple destinations.
For example a grant with
resource=kubernetes.dev
could mean the default namespace for a destination namedkubernetes.dev
, or it could mean thedev
namespace for a destination namedkubernetes
.We could decide to separate destination from the resource on the grant, which would allow us to support dots in destination names. That's a much larger change, so until we decide we need that, we have to exclude dots from destination names.
We don't have any telemetry for destination names. I think we need to make this change regardless, but we should be careful to call this out in the release notes as a potentially breaking change. We may want to combine this with the change to the connector helm chart, and the change to add a unique constraint to destination names.