diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index 85617c8f0b3abb3fee785580dcf91ef493236bf6..5aa6ce7035ade0b3ac59ead82a62d9acb2f21caa 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/cfg.result b/test/box/cfg.result index 5370bb8703db81148544913746b3f24c813eeee6..fe20eea011839dbcb7df5c991a6ad02dad1b580e 100644 --- a/test/box/cfg.result +++ b/test/box/cfg.result @@ -580,3 +580,33 @@ test_run:cmd("cleanup server cfg_tester6") | --- | - true | ... + +-- +-- gh-4493: Replication user password may leak to logs +-- +test_run:cmd('create server cfg_tester7 with script = "box/lua/cfg_test6.lua"') + | --- + | - true + | ... +test_run:cmd("start server cfg_tester7") + | --- + | - true + | ... +-- test there is replication log in log +test_run:grep_log('cfg_tester7', 'set \'replication\' configuration option to', 1000) + | --- + | - set 'replication' configuration option to + | ... +-- test there is no password in log +test_run:grep_log('cfg_tester7', 'test%-cluster%-cookie', 1000) + | --- + | - null + | ... +test_run:cmd("stop server cfg_tester7") + | --- + | - true + | ... +test_run:cmd("cleanup server cfg_tester7") + | --- + | - true + | ... diff --git a/test/box/cfg.test.lua b/test/box/cfg.test.lua index 56ccb6767df4af7e3ee5e611d165d1ee832a5043..ba273bb73945edd0db2eb63710e600ba7f1ba793 100644 --- a/test/box/cfg.test.lua +++ b/test/box/cfg.test.lua @@ -141,3 +141,15 @@ test_run:cmd("start server cfg_tester6") test_run:grep_log('cfg_tester6', 'set \'vinyl_memory\' configuration option to 1073741824', 1000) test_run:cmd("stop server cfg_tester6") test_run:cmd("cleanup server cfg_tester6") + +-- +-- 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") diff --git a/test/box/lua/cfg_test6.lua b/test/box/lua/cfg_test6.lua new file mode 100644 index 0000000000000000000000000000000000000000..efcfc6f3e1e0467917b500c5fa423117ea061555 --- /dev/null +++ b/test/box/lua/cfg_test6.lua @@ -0,0 +1,10 @@ +#!/usr/bin/env tarantool +os = require('os') + +box.cfg{ + listen = os.getenv("LISTEN"), + replication = "admin:test-cluster-cookie@" .. os.getenv("LISTEN"), + replication_connect_timeout = 0.1, +} + +require('console').listen(os.getenv('ADMIN'))