Skip to content

Commit

Permalink
MB-49705 [BP] Don't leak sensitive information (engage_cluster)
Browse files Browse the repository at this point in the history
Prior to this change a crash while doing an engage_cluster could leak
sensitive information such as PRIVATE KEYs. We know wrap the list of
arguments used by engage_cluster in a function and pass the function
instead.

This is a backport of MB-48222.

Change-Id: I5b268d525f6c58114fbe169d9ba7fc3f75845a9b
Reviewed-on: https://review.couchbase.org/c/ns_server/+/172372
Well-Formed: Build Bot <build@couchbase.com>
Well-Formed: Restriction Checker
Reviewed-by: Bryan McCoid <bryan.mccoid@couchbase.com>
Tested-by: Steve Watanabe <steve.watanabe@couchbase.com>
  • Loading branch information
stevewatanabe committed Mar 17, 2022
1 parent 33aec16 commit 4a54f7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ns_cluster.erl
Expand Up @@ -293,7 +293,9 @@ ensure_dist_ports_match(NodeKVList) ->
end.

call_engage_cluster(NodeKVList) ->
gen_server:call(?MODULE, {engage_cluster, NodeKVList}, ?ENGAGE_TIMEOUT).
NodeKVListThunk = fun () -> NodeKVList end,
gen_server:call(?MODULE, {engage_cluster, NodeKVListThunk},
?ENGAGE_TIMEOUT).

complete_join(NodeKVList) ->
gen_server:call(?MODULE, {complete_join, NodeKVList}, ?COMPLETE_TIMEOUT).
Expand Down Expand Up @@ -407,7 +409,8 @@ handle_call({add_node_to_group, Scheme, RemoteAddr, RestPort, Auth, GroupUUID,
[Scheme, RemoteAddr, RestPort, GroupUUID, RV]),
{reply, RV, State};

handle_call({engage_cluster, NodeKVList}, _From, State) ->
handle_call({engage_cluster, NodeKVListThunk}, _From, State) ->
NodeKVList = NodeKVListThunk(),
?cluster_debug("handling engage_cluster(~p)", [sanitize_node_info(NodeKVList)]),
RV = do_engage_cluster(NodeKVList),
?cluster_debug("engage_cluster(..) -> ~p", [RV]),
Expand Down

0 comments on commit 4a54f7b

Please sign in to comment.