Harden securityContext on the bundled postgres StatefulSet
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 77/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- go, kubernetes, yaml
- Domain
- databases, infrastructure, security
Research direction
Start with manifests/ate-install/postgres/postgres.yaml and inspect the postgres and tls-reloader container security contexts alongside the existing pod-level fsGroup. Add the requested restrictions while preserving the postgres container's TLS-compatible identity settings; then review pod-certificate-controller.yaml for the unused NET_BIND_SERVICE capability. Done when the requested container restrictions and capability cleanup are represented in the manifests.
Written by the indexing model from the issue text.
Description
The default install StatefulSet in manifests/ate-install/postgres/postgres.yaml already sets a careful pod-level fsGroup: 70 and documents why the postgres container must not pin runAsUser: pinning it would make the projected TLS key group-readable, and PostgreSQL would refuse to start.
The main postgres container still has no container securityContext at all, and the tls-reloader sidecar only sets runAsUser: 70:
That leaves allowPrivilegeEscalation at the Kubernetes default (true), does not drop capabilities (including NET_RAW), and does not set runAsNonRoot. The official postgres:18-alpine image already runs as UID 70, so runAsNonRoot: true without runAsUser on the main container should be compatible with the TLS constraint above.
This is leftover install hardening after #2936 / #3028, which covered the Substrate control-plane pods but not the bundled database. Authentication for that database is already in good shape (client certificates, hostssl ... cert, and a NetworkPolicy that admits only ate-api-server). This request is only about the pod security context.
Suggested container securityContext:
For postgres (do not set runAsUser):
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop:
- ALL
For tls-reloader, keep runAsUser: 70 and add the same allowPrivilegeEscalation: false, runAsNonRoot: true, and capabilities.drop: [ALL].
Optional: seccompProfile: {type: RuntimeDefault} on the pod or containers.
Related: unused NET_BIND_SERVICE on podcertificate-controller
ate-api-server correctly keeps NET_BIND_SERVICE because it binds :443. The same capability is still set on podcertificate-controller:
cmd/podcertcontroller is a kube-apiserver client; it does not listen on a privileged port (or any port). Dropping the add list would leave drop: [ALL] only.
Found with Rustmaninoff (https://github.com/jose-compu/rustmaninoff), a Checkov-compatible IaC scanner; check IDs CKV_K8S_20, CKV_K8S_23, CKV_K8S_28, and CKV_K8S_25.
- Dominant language
- Go
- Stars
- 8.7k
- Forks
- 969
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 128
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from agent-substrate/substrate
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
agent-substrate/substrate#4308 ·
Maintainers usually reply within 2 days
-
area/observability kind/feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agent-substrate/substrate#4275 ·
Maintainers usually reply within 2 days
-
area/dev-infra kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agent-substrate/substrate#4248 · 1 comment ·
Maintainers usually reply within 2 days
-
area/node area/security kind/feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agent-substrate/substrate#4188 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug]: ExternalVolumeStatus.volume_type demands a prefix of "substrate.io" which we do not ownPossibly taken @msau42 claimed this 7 days ago. Openarea/api area/storage kind/bug ready-for-pr
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
agent-substrate/substrate#4129 · 1 assignee ·
Maintainers usually reply within 2 days
All issues in agent-substrate/substrate
Similar issues
-
bug effort:s impact:med raised-by:worker risk:low to:worker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
medici-finance/assay#8120 · 1 comment ·
Maintainers usually reply within 1 day
-
factory:subtask
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
ci good first issue severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
TMHSDigital/Spackle#206 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
celestiaorg/celestia-app#8877 ·
Maintainers usually reply within 1 day
-
sweep
Difficulty 1/5 Under an hour Newbie friendliness 84/100
bketelsen/truenas-mcp#112 ·
Maintainers usually reply within 1 day