Tarantool development patches archive
 help / color / mirror / Atom feed
From: Maria <maria.khaydich@tarantool.org>
To: tarantool-patches@dev.tarantool.org, georgy@tarantool.org
Subject: [Tarantool-patches] [PATCH] Check for not logging password added
Date: Wed, 13 Nov 2019 18:28:06 +0300	[thread overview]
Message-ID: <20191113152806.98699-1-maria.khaydich@tarantool.org> (raw)

It was possible to leak user password through
setting 'replication' configuration option in
box.cfg. Logging in load_cfg function used to
be unconditional unlike reload_cfg.

Closes #4493

Issue:
https://github.com/tarantool/tarantool/issues/4493
Branch:
https://github.com/tarantool/tarantool/compare/eljashm/gh-4493-box.cfg-log-may-leak-passwords
---
 src/box/lua/load_cfg.lua   |  3 +++
 test/box/load_cfg.test.lua | 14 ++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 test/box/load_cfg.test.lua

diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 85617c8f0..5aa6ce703 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -548,6 +548,9 @@ local function load_cfg(cfg)
                 fun()
             end
             if not compare_cfg(val, default_cfg[key]) then
+                if log_cfg_option[key] ~= nil then
+                    val = log_cfg_option[key](val)
+                end
                 log.info("set '%s' configuration option to %s", key, json.encode(val))
             end
         end
diff --git a/test/box/load_cfg.test.lua b/test/box/load_cfg.test.lua
new file mode 100644
index 000000000..e0c3b361b
--- /dev/null
+++ b/test/box/load_cfg.test.lua
@@ -0,0 +1,14 @@
+env = require('test_run')
+test_run = env.new()
+
+--
+-- gh-4493: Replication user password may leak to logs
+--
+test_run:cmd('create server cfg_tester7 with script = "box/lua/cfg_test6.lua"')
+test_run:cmd("start server cfg_tester7")
+-- test there is replication log in log
+test_run:grep_log('cfg_tester7', 'set \'replication\' configuration option to', 1000)
+-- test there is no password in log
+test_run:grep_log('cfg_tester7', 'test-cluster-cookie', 1000)
+test_run:cmd("stop server cfg_tester7")
+test_run:cmd("cleanup server cfg_tester7")
-- 
2.21.0 (Apple Git-122.2)

                 reply	other threads:[~2019-11-13 15:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191113152806.98699-1-maria.khaydich@tarantool.org \
    --to=maria.khaydich@tarantool.org \
    --cc=georgy@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] Check for not logging password added' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox