Skip to content

Commit 240ed3d

Browse files
committed
MB-49523 [BP] Sanitize goport env to prevent it being logged...
... in case of a crash Reason: env might contain sensitive info in some cases (for example, when cbimport is called) This is a backport of MB-49370. Change-Id: I51e5f5c67aecebea6ed0062a82e742114311edc0 Reviewed-on: https://review.couchbase.org/c/ns_server/+/172293 Well-Formed: Build Bot <[email protected]> Well-Formed: Restriction Checker Reviewed-by: Timofey Barmin <[email protected]> Tested-by: Steve Watanabe <[email protected]>
1 parent 54b6eed commit 240ed3d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/goport.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
cmd :: string(),
2727
args :: [string()],
2828
stderr_to_stdout :: boolean(),
29-
env :: [{string(), string()}],
29+
env :: [{string(), string()}] | sanitized,
3030
cd :: undefined | string(),
3131
exit_status :: boolean(),
3232
line :: undefined | pos_integer(),
@@ -113,6 +113,8 @@ init([Owner, Path, Opts]) ->
113113
process_flag(trap_exit, true),
114114
Port = start_port(Config),
115115

116+
SanitizedConfig = Config#config{env = sanitized},
117+
116118
State = #state{port = Port,
117119
owner = Owner,
118120
ctx = #decoding_context{},
@@ -126,7 +128,7 @@ init([Owner, Path, Opts]) ->
126128
delivered_bytes = 0,
127129
pending_ack_bytes = 0,
128130
have_pending_ack = false,
129-
config = Config},
131+
config = SanitizedConfig},
130132
{ok, State};
131133
{error, Reason} ->
132134
{stop, Reason}

0 commit comments

Comments
 (0)