public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager] ceph: cfg: fix config key filter returning all section keys
@ 2026-03-29  2:56 Kefu Chai
  0 siblings, 0 replies; only message in thread
From: Kefu Chai @ 2026-03-29  2:56 UTC (permalink / raw)
  To: pve-devel

The configdb loop fetching specific keys from 'config dump' contained
a tautology:

  $config->{$n_section}->{$n_name} = $value
      if defined $requested_keys->{$n_section} && $n_name eq $n_name;

The condition '$n_name eq $n_name' is always true, so the second clause
never actually filters by requested key. As a result, ALL keys from any
section that appeared in the request were returned to the caller instead
of only the specifically requested ones.

Compare with the correct pattern used just below in the ceph.conf path:

  $config->{$n_section}->{$n_key} = $config_file->{$section}->{$key}
      if $requested_keys->{$n_section}->{$n_key};

Fix: replace the tautological two-part condition with the same
single hash-dereference form. This is falsy when the section is absent
and falsy when the specific key is not requested, correctly filtering
the configdb output to only the keys the caller asked for.

Symptom: calling the '/ceph/cfg/value' API with a specific key like
'global:auth_cluster_required' would return every key in the [global]
section from the Ceph config database instead of only that one key.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
---
 PVE/API2/Ceph/Cfg.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Ceph/Cfg.pm b/PVE/API2/Ceph/Cfg.pm
index 9d16caf2..8798f12a 100644
--- a/PVE/API2/Ceph/Cfg.pm
+++ b/PVE/API2/Ceph/Cfg.pm
@@ -174,7 +174,7 @@ __PACKAGE__->register_method({
             my $n_name = $normalize->($name);
 
             $config->{$n_section}->{$n_name} = $value
-                if defined $requested_keys->{$n_section} && $n_name eq $n_name;
+                if $requested_keys->{$n_section}->{$n_name};
         }
 
         # read ceph.conf after config db as it has priority if settings are present in both
-- 
2.47.3





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-29  2:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-29  2:56 [PATCH manager] ceph: cfg: fix config key filter returning all section keys Kefu Chai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal