The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7952

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From afe4734d43143cba7bc84489941e698faf585cd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Tue, 29 Sep 2020 10:06:31 -0400
Subject: [PATCH] lxd/api: Restrict access to daemon config
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/api_1.0.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index a9cc397146..72212579a2 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -251,9 +251,12 @@ func api10Get(d *Daemon, r *http.Request) 
response.Response {
 
        fullSrv := api.Server{ServerUntrusted: srv}
        fullSrv.Environment = env
-       fullSrv.Config, err = daemonConfigRender(d.State())
-       if err != nil {
-               return response.InternalError(err)
+
+       if d.userIsAdmin(r) {
+               fullSrv.Config, err = daemonConfigRender(d.State())
+               if err != nil {
+                       return response.InternalError(err)
+               }
        }
 
        return response.SyncResponseETag(true, fullSrv, fullSrv.Config)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to