]> git.proxmox.com Git - pve-manager.git/commitdiff
api: nodes: allow usage of query url metadata with Sys.AccessNetwork
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 19 Feb 2024 16:27:46 +0000 (17:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 28 Feb 2024 14:53:28 +0000 (15:53 +0100)
This was restricted to Sys.Modify + Sys.Audit on the whole cluster to
ensure that only trusted users get access to a method that can scan
the (local) network from the POV of the Proxmox VE node, even if only
through HTTP HEAD requests.

Nowadays there's enough user interest [0] to warrant a separate access
privilege to cover such an use case, and while most of the requests
are for the download-url storage API endpoint, this method here is not
only a bit less powerful than the storage one, it's rather tied to the
latter anyway (e.g. for querying the metadata of a URL in the web UI
for name and size before downloading it to a storage).

For backwards compatibility keep the old check and add the new
privilege as alternative to fulfill the permission requirements of
that API endpoint.

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=5254

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/API2/Nodes.pm

index 67a8ce222606468b0ada14b4007451fd34408f8c..cc5ee65e8e9226e1efc9904c1cf41828a69ab872 100644 (file)
@@ -1620,7 +1620,10 @@ __PACKAGE__->register_method({
     description => "Query metadata of an URL: file size, file name and mime type.",
     proxyto => 'node',
     permissions => {
-       check => ['perm', '/', [ 'Sys.Audit', 'Sys.Modify' ]],
+       check => ['or',
+           ['perm', '/', [ 'Sys.Audit', 'Sys.Modify' ]],
+           ['perm', '/nodes/{node}', [ 'Sys.AccessNetwork' ]],
+       ],
     },
     parameters => {
        additionalProperties => 0,