public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] fix: api: fix permission check for cloudinit drive update
@ 2023-03-13 12:56 Friedrich Weber
  2023-07-24 11:46 ` Friedrich Weber
  2023-07-25 15:23 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Friedrich Weber @ 2023-03-13 12:56 UTC (permalink / raw)
  To: pve-devel

Trying to regenerate a cloudinit drive as a non-root user via the API
currently throws a Perl error, as reported in the forum [1]. This is
due to a type mismatch in the permission check, where a string is
passed but an array is expected.

[1] https://forum.proxmox.com/threads/regenerate-cloudinit-by-put-api-return-500.124099/

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---
 To see if we have the same problem for other API endpoints, I ran:
    grep -r "['\"]perm['\"][^[]*]" .
 in my locally checked-out repos, but found only this single occurrence.

 PVE/API2/Qemu.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 587bb22..0ea18eb 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1398,7 +1398,7 @@ __PACKAGE__->register_method({
     proxyto => 'node',
     description => "Regenerate and change cloudinit config drive.",
     permissions => {
-	check => ['perm', '/vms/{vmid}', 'VM.Config.Cloudinit'],
+	check => ['perm', '/vms/{vmid}', ['VM.Config.Cloudinit']],
     },
     parameters => {
 	additionalProperties => 0,
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-25 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 12:56 [pve-devel] [PATCH qemu-server] fix: api: fix permission check for cloudinit drive update Friedrich Weber
2023-07-24 11:46 ` Friedrich Weber
2023-07-25 15:23 ` [pve-devel] applied: " Thomas Lamprecht

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