Skip to content

Commit 6cf72d2

Browse files
committed
CA-187261: Don't log the password during SR attach
Signed-off-by: Sharad Yadav <[email protected]>
1 parent d53dcb7 commit 6cf72d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ocaml/xapi/storage_impl.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,12 @@ module Wrapper = functor(Impl: Server_impl) -> struct
736736
Impl.SR.set_name_description context ~dbg ~sr ~new_name_description
737737

738738
let attach context ~dbg ~sr ~device_config =
739-
info "SR.attach dbg:%s sr:%s device_config:[%s]" dbg sr (String.concat "; " (List.map (fun (k, v) -> k ^ ":" ^ v) device_config));
739+
let censor_key = ["password"] in
740+
let device_config_str = String.concat "; " (List.map (fun (k, v) ->
741+
let v' = (if List.exists (Xstringext.String.has_substr k) censor_key then "(omitted)" else v) in
742+
(k ^ ":" ^ v')) device_config)
743+
in
744+
info "SR.attach dbg:%s sr:%s device_config:[%s]" dbg sr device_config_str;
740745
with_sr sr
741746
(fun () ->
742747
match Host.find sr !Host.host with

0 commit comments

Comments
 (0)