Repository navigation
Build releases with the newest Go 1.26 patch, and add --readonly - #5
Conversation
Every release so far, v0.1.6 included, was built with Go 1.26.0: setup-go read the version from go.mod's `go` line, which is the oldest Go the code builds with rather than the toolchain to ship. A trivy scan of the v0.1.6 linux/amd64 binary lists 33 standard library vulnerabilities (22 rated high) that are fixed in 1.26.1 through 1.26.6, among them crypto/x509 certificate validation and crypto/tls issues. Build releases with the newest 1.26 patch, and print `go version` in the build log so every release shows which toolchain made it.
`k10s --readonly` (also `--read-only`, before or after `demo`) opens the dashboard with nothing that can change the cluster, for looking at clusters such as production without the risk of a stray key. The UI hides Edit, Scale, Rollout Restart, Cordon, Drain and Delete, and Shell and Port Forward, which open a session into the cluster. Their keys, and `:scale`, answer with a notice instead of a dialog. Plugins marked dangerous are hidden, as in k9s, and typed shell commands do not run, since they run as the user, outside k10s. The header shows READ-ONLY while the mode is on. The same rule holds on the wire. Every client built from the kubeconfig gets a transport that refuses, before the request leaves the machine, anything other than GET, HEAD or OPTIONS, plus the GETs that open exec, attach and port-forward streams over WebSockets. The tests drive a clientset, the exec executor and the port-forward dialer against a recording server and check that only the read reaches it.
|
Reviewed both commits, approving. Verified locally: The release change is correct as well; Three optional follow-ups, none blocking:
Happy to merge as is and take these separately. |
A GET through .../pods/<name>/proxy/..., .../services/<name>/proxy/... or .../nodes/<name>/proxy/... is passed on to whatever listens behind it, and behind a node proxy is the kubelet, whose own API includes exec. The read-only transport let those through: it only knew the stream subresources, which always end the path. proxy is followed by the path it forwards, so the guard now looks for it anywhere in the path, anchored on "namespaces" for pods and services and on "v1" for nodes, which keeps objects that are merely named "proxy" readable. k10s never sends these requests itself. Suggested in the review of #5.
|
Thanks for reviewing and merging all three. On 1, I would keep k9s's behaviour, which the docs already describe: read-only mode hides the plugins marked On 3, I would keep Would you cut a release when you have a moment? The v0.1.6 binaries were built with Go 1.26.0, and trivy lists 33 standard-library vulnerabilities in them (22 high). A build of main with the release flags on Go 1.26.8, the newest 1.26 patch today, scans clean. Anyone on v0.1.6 would see the new version in the status bar within a day. |
Two changes, one commit each.
1. Release binaries carry an old Go standard library
Every release so far, v0.1.6 included, was built with Go 1.26.0.
setup-goreadsgo-version-file: go.mod, and go.mod'sgoline is the oldest Go the code builds with, not the toolchain to ship. A trivy scan of the v0.1.6 linux/amd64 binary lists 33 standard library vulnerabilities (22 rated high) that are fixed in 1.26.1 through 1.26.6, among them crypto/x509 certificate validation and crypto/tls issues.The workflow now asks for
1.26.xwithcheck-latest: true, so every release takes the newest 1.26 patch, and the build step printsgo versionso the log shows which one it used. go.mod is unchanged; when it moves to 1.27, this line moves with it. A new tag after merging would ship patched binaries.2.
--readonlyk10s --readonly(also--read-only, before or afterdemo) is for looking at a cluster you must not change, such as production, in the spirit of k9s's--readonly.:scaleshow a notice instead of a dialog. Plugins withdangerous: trueare hidden, as in k9s. Typed shell commands do not run: they run as the user, outside k10s, so read-only mode cannot vouch for them. The header shows READ-ONLY while the mode is on.k8s.Newwraps the rest.Config in a transport that refuses, before the request leaves the machine, anything other than GET, HEAD and OPTIONS, plus the GETs that open exec, attach and port-forward streams over WebSockets. Every client is built from that config, the SPDY and WebSocket paths for exec and port-forward included, so a code path the UI misses still cannot write.The policy is
domain.ReadOnlyAllows; the transport isinternal/k8s/readonly.go. Docs: the README usage block, a "Read-only mode" section in docs/commands.md, and thedangerousfield in docs/plugins.md. I kept this to the flag; areadonlykey in config.yaml could follow if you want one.Testing
go vet ./...andgo test ./...pass, and the binary builds for every release platform.:scale, typed shell commands and dangerous plugins while still describing; the header tag; and the flag parser.Happy to split this into two PRs if you prefer.