Skip to content

[Backport release-1.3] feat(postgres)!: support all PostgreSQL configuration parameters - #2595

Closed
github-actions[bot] wants to merge 12 commits into
release-1.3from
backport-2466-to-release-1.3
Closed

github-actions[bot] wants to merge 12 commits into
release-1.3from
backport-2466-to-release-1.3

Conversation

@github-actions

@github-actions github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

Description

Backport of #2466 to release-1.3.

IvanHunters and others added 12 commits May 7, 2026 14:15
Allow users to configure any PostgreSQL server parameter via the
postgresql.parameters field. All parameter values must be provided
as strings (numeric values should be quoted).

Security measures:
- Block parameters that allow shell command execution (archive_command,
  restore_command, ssl_passphrase_command, log_destination, event_source)
- Validation implemented in templates to prevent security vulnerabilities

Generated files updated:
- types.go: Add Parameters field with map[string]string type
- README.md: Add parameter documentation and warnings
- values.schema.json: Update schema for new field
- CRD: Update OpenAPI schema with new field and reordered properties

CloudNativePG manages certain parameters automatically (archive_mode,
primary_conninfo, wal_level). Users should not override these as it
may break backup/replication functionality.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit fb0ed08)
- Regenerate deepcopy artifacts to remove orphaned PostgreSQLParameters methods
- Update e2e test to use string value for max_connections parameter
- Fix template to avoid .Values mutation and use quote function for safe YAML escaping

Signed-off-by: ohotnikov.ivan <[email protected]>
(cherry picked from commit f8001e2)
Fix regression where defaults were overriding user-supplied parameters.
Sprig merge gives precedence to first argument, so user values must be
merged before defaults to maintain correct override behavior.

Before: merge (dict) $defaults .Values.postgresql.parameters
After:  merge (dict) .Values.postgresql.parameters $defaults

Now max_wal_senders and other user parameters correctly override defaults.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit 96c7c16)
PostgreSQL parameter names are case-insensitive, but the denylist
check was case-sensitive, allowing bypass via mixed-case names
(e.g., ARCHIVE_COMMAND instead of archive_command).

Normalize parameter names to lowercase before checking against the
denylist to prevent security bypass.

Thanks to CodeRabbit for catching this security issue.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit fac0622)
…theusRule

Helm was trying to evaluate {{ $labels.xxx }} as Helm variables, causing
"undefined variable" errors during E2E tests. Wrap Prometheus template
expressions in backticks to pass them through Helm unchanged.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit a753088)
Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit c2bad2a)
…d compat

Allow integer values in postgresql.parameters via anyOf schema, so existing
HelmReleases with max_connections: 100 (integer) are not broken on upgrade.
Template coerces all values to string via toString before quoting.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit 6ec761f)
Remove log_destination and event_source (not code-execution vectors).
Add dynamic_library_path, local_preload_libraries, session_preload_libraries,
shared_preload_libraries which allow loading arbitrary .so files.
Improve error message accuracy.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit 97d8f84)
… postgres

Revert the kubevirt-operator PrometheusRule changes that were included
in this PR by mistake. These changes will be submitted in a separate PR
for cleaner attribution.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit a4d3c99)
Update values.yaml comments and README to reflect the corrected denylist:
remove log_destination and event_source (not code-execution vectors),
add dynamic_library_path and *_preload_libraries (arbitrary .so loading).

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit 95f7be7)
Update description in values.yaml with corrected denylist and re-run
cozyvalues-gen to propagate changes to values.schema.json, README.md,
and types.go.

Signed-off-by: IvanHunters <[email protected]>
(cherry picked from commit 53caea3)
@dosubot dosubot Bot added area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line kind/breaking-change Indicates the change introduces a breaking API or behaviour change kind/feature Categorizes issue or PR as related to a new feature labels May 7, 2026
@myasnikovdaniil
myasnikovdaniil marked this pull request as draft May 8, 2026 03:55
@myasnikovdaniil myasnikovdaniil added the do-not-merge/hold Indicates that a PR should not merge because someone has issued /hold label May 8, 2026
@myasnikovdaniil

Copy link
Copy Markdown
Contributor

Too dangerous to be backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) do-not-merge/hold Indicates that a PR should not merge because someone has issued /hold kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line kind/breaking-change Indicates the change introduces a breaking API or behaviour change kind/feature Categorizes issue or PR as related to a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants