config api/plugins: let plugins define sensitive properties themselves
Hard-coding a list of sensitive properties means that custom plugins cannot define their own sensitive properties for the on_add/on_update hooks. Have plugins declare the list of their sensitive properties in the plugin data. For backwards compatibility, return the previously hard-coded list if no such declaration is present. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Link: https://lore.proxmox.com/20250404133204.239783-6-f.ebner@proxmox.com
This commit is contained in:
committed by
Thomas Lamprecht
parent
ff971aefc0
commit
db5c50c079
@ -190,8 +190,6 @@ __PACKAGE__->register_method ({
|
||||
return &$api_storage_config($cfg, $param->{storage});
|
||||
}});
|
||||
|
||||
my $sensitive_params = [qw(password encryption-key master-pubkey keyring)];
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'create',
|
||||
protected => 1,
|
||||
@ -239,6 +237,7 @@ __PACKAGE__->register_method ({
|
||||
# fix me in section config create never need an empty entity.
|
||||
delete $param->{nodes} if !$param->{nodes};
|
||||
|
||||
my $sensitive_params = PVE::Storage::Plugin::sensitive_properties($type);
|
||||
my $sensitive = extract_sensitive_params($param, $sensitive_params, []);
|
||||
|
||||
my $plugin = PVE::Storage::Plugin->lookup($type);
|
||||
@ -344,6 +343,7 @@ __PACKAGE__->register_method ({
|
||||
my $scfg = PVE::Storage::storage_config($cfg, $storeid);
|
||||
$type = $scfg->{type};
|
||||
|
||||
my $sensitive_params = PVE::Storage::Plugin::sensitive_properties($type);
|
||||
my $sensitive = extract_sensitive_params($param, $sensitive_params, $delete);
|
||||
|
||||
my $plugin = PVE::Storage::Plugin->lookup($type);
|
||||
|
||||
Reference in New Issue
Block a user