From: Kefu Chai <k.chai@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] ceph: cfg: fix config key filter returning all section keys
Date: Sun, 29 Mar 2026 10:56:15 +0800 [thread overview]
Message-ID: <20260329025615.1837601-1-k.chai@proxmox.com> (raw)
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
reply other threads:[~2026-03-29 2:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260329025615.1837601-1-k.chai@proxmox.com \
--to=k.chai@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox