Our Kubernetes desktop app had a bug I'm not proud of. If you added a remote cluster with a bearer token (or a client cert, exec plugin, OIDC) and left the CA field empty, the app wrote insecure-skip-tls-verify: true into the generated kubeconfig. No warning anywhere. So the token went to a server whose identity nobody checked.
The CA field looked optional. That was the whole problem. Empty felt like "use defaults", and the default was "trust anything".
Worse part: a check with the right policy already existed in the code. Nothing called it. Four forms built their kubeconfig on their own and none of them went through it.
What changed in 0.26.3
- a remote cluster with no CA is refused, and the form says why
- skipping verification is an explicit checkbox with a warning, per connection, and you can't tick it while the CA field has text (kubectl refuses both anyway)
- plain HTTP to a remote host stays refused, checkbox or not
- localhost still connects without a CA, but verification stays on
There's also a test now that fails if anything except that one function writes the flag.
The part we didn't expect
While fixing it we found a second way in. A kubeconfig is YAML, and kubectl and js-yaml don't agree on what ends a line. NEL, LS and PS (U+0085, U+2028, U+2029) end a line for kubectl but stay inside a value for js-yaml. So one pasted character in the CA field could sneak insecure-skip-tls-verify: true, or a whole exec block, past the check. Now server URL, token, cert and key must be visible ASCII, the CA must be base64, and we tried it with real clipboard pastes into the app against minikube.
And a boring one. The CA field is a single-line input, so a pasted multi-line PEM gets its line breaks turned into spaces, and kubectl then fails with unable to load root certificates. The breaks are restored before anything is written.
If you added a cluster before 0.26.3
Old clusters keep the kubeconfig they were saved with. If you left the CA empty, remove the cluster and add it again with its CA.
Honestly this one is worth running whatever tool you use:
grep -n "insecure-skip-tls-verify" ~/.kube/config
Release notes: https://github.com/ceh13-community/rozoom/releases/tag/app-v0.26.3
The app (free, Apache 2.0): https://rozoom.app/?utm_source=devto&utm_medium=article&utm_campaign=s29-ca-tls
Curious how other tools treat the "optional CA" case. Seen one that gets it right?
Top comments (0)