fix(operator): run the operator as a non-root, read-only container (#297 part 1) - #298
Merged
Conversation
The pod holds a cluster token, the database DSN and the field encryption key; it writes nothing to its own filesystem, so nothing needs uid 0.
This was referenced Jul 28, 2026
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of #297 (non-root runtime + securityContext). Parts 2 (scoped RBAC) and 3 (dedicated DB credentials) follow as their own PRs.
Dockerfile—USER 65534:65534on thelnvps-operatorstage only. uid 65534 isnobodyindebian:trixie-slim, the runtime base.lnvps_operator/k8s-minimal.yaml— podrunAsNonRoot/runAsUser/fsGroup65534, containerallowPrivilegeEscalation: false,readOnlyRootFilesystem: true,capabilities: drop: ["ALL"].lnvps_operator/README.md— a "Runtime hardening" section. The README already claimed non-root and read-only under Monitoring; now it is true.Nothing in the operator writes to its own filesystem: the only
std::fswrite path inlnvps_operator/srcis the encryption key file, and only whenencryption.auto-generateis set (lnvps_operator/src/main.rs:159->lnvps_db/src/encryption.rs:54). That option cannot work underreadOnlyRootFilesystem, and a generated key would not match the API's anyway — the README now says to useLNVPS_ENCRYPTION_KEYor a read-only Secret mount, which is what the manifest already does. The config is a read-only ConfigMap mount.No test: this is the example manifest and the image definition, neither of which is what the cluster runs. Verified
uid=65534(nobody)exists indebian:trixie-slimand that the manifest parses with both securityContexts on the right objects.cargo test --workspaceunchanged and green (lnvps_e2easide, which needs live services).Merging changes nothing in the cluster — the running operator picks this up when its image is rebuilt and the Deployment is re-applied, and per #295 the live install does not come from this manifest. Kieran's call on how it is rolled out.
Channel: lnvps (f5894ea9-44c7-56fb-bd9b-6e3e671e4bc1)