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
@ -245,6 +245,18 @@ sub dirs_hash_to_string {
|
||||
return join(',', map { "$_=$hash->{$_}" } sort keys %$hash);
|
||||
}
|
||||
|
||||
sub sensitive_properties {
|
||||
my ($type) = @_;
|
||||
|
||||
my $data = $defaultData->{plugindata}->{$type};
|
||||
if (my $sensitive_properties = $data->{'sensitive-properties'}) {
|
||||
return [sort keys $sensitive_properties->%*];
|
||||
}
|
||||
|
||||
# For backwards compatibility. This list was hardcoded in the API module previously.
|
||||
return [qw(encryption-key keyring master-pubkey password)];
|
||||
}
|
||||
|
||||
sub storage_has_feature {
|
||||
my ($type, $feature) = @_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user