Open Miles-Garnsey opened 1 year ago
I suggest we should vet this at the webhook layer and then again via the controllers.
Can't we make ServerVersion
mandatory to make this simpler, by using // +kubebuilder:validation:Required
?
That does validation at the OpenAPI layer right? That's probably even better than the webhook, agreed.
Or just have the regexp there also? This is what cass-operator does:
// +kubebuilder:validation:Pattern=(6\.8\.\d+)|(3\.11\.\d+)|(4\.\d+\.\d+)
ServerVersion string `json:"serverVersion"`
Right, but there's "omitempty", which allows there to be a nil.
good point 👍 that's what we need to fix then.
What happened?
The operator is not resilient to cases where the
spec.cassandra.serverVersion
isnil
.Did you expect to see something different?
Even malformed CRs should not cause crashes. This could lead to a DOS issue in multi-tenant clusters.
How to reproduce it (as minimally and precisely as possible):
When creating a
K8ssandraCluster
, it appears that I can crash the operator by submitting the following CR:┆Issue is synchronized with this Jira Story by Unito ┆Issue Number: K8OP-224