Fedora Account System
Red Hat Associate
Red Hat Customer
## Hardcoded Clair Postgres credential postgres/postgres on upgrade path **CWEs:** CWE-798 **CVSS:** 7.7 (CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:N) **Component:** quay/quay-operator ### Description When `ComponentClairPostgres` is managed and `ctx.ClairDbPassword` is empty, the code branches on whether `ctx.DbRootPw` is already populated (i.e., whether this is an existing deployment whose managed-keys Secret predates per-Clair credentials). For that upgrade branch it sets `ctx.ClairDbPassword = "postgres"` (the legacy hardcoded value), then `ctx.ClairDbRootPw = ctx.ClairDbPassword`, `ctx.ClairDbUser = "postgres"`, `ctx.ClairDbName = "postgres"`. The resulting `clair-postgres` Deployment is configured with superuser `postgres` / password `postgres`, and the same value is written into the Clair `config.yaml` connstring (`secrets.go:411`). The `clair-postgres` Service (`ClusterIP`) is reachable from any pod in the cluster absent NetworkPolicy. ### Affected Locations - `pkg/kustomize/kustomize.go:349-369` ### Attack Pattern Any pod on the cluster network can authenticate to the Clair vulnerability database of an upgraded Quay instance using a publicly-known credential, allowing read/write of vulnerability scan results and arbitrary SQL execution as the `postgres` superuser. ### Remediation Generate a random password on the upgrade branch as well, and run a one-shot `ALTER ROLE postgres PASSWORD ...` Job against the existing database before rotating the connstring; persist the new value in the managed-keys Secret. Remove the literal `"postgres"` fallback. --- *Source: Ex-Wing security assessment, finding FIND-004*