MT#21683 respect log_password config option and hide passwords if disabled

Change-Id: I58cf444339b84419e8255c3345ad47f89c79ac23
changes/39/7439/5
Kirill Solomko 9 years ago
parent 075a950760
commit b821f24ee7

@ -62,11 +62,15 @@ sub get_log_params {
? $c->request->query_params ? $c->request->query_params
: $c->request->parameters; : $c->request->parameters;
if ($data_ref) { if ($data_ref) {
my $log_passwords = $c->config->{security}{log_passwords} || 0;
my %parsed_data_ref = map { $_ => defined $data_ref->{$_} my %parsed_data_ref = map { $_ => defined $data_ref->{$_}
? length($data_ref->{$_}) > 500 ? length($data_ref->{$_}) > 500
? '*too big*' ? '*too big*'
: $data_ref->{$_} : (!$log_passwords && $_ =~ /password/i
: 'undef' && $data_ref->{$_})
? '*' x length($data_ref->{$_})
: $data_ref->{$_}
: 'undef'
} keys %$data_ref; } keys %$data_ref;
$data_str = Data::Dumper->new([ \%parsed_data_ref ]) $data_str = Data::Dumper->new([ \%parsed_data_ref ])
->Terse(1) ->Terse(1)
@ -86,8 +90,6 @@ sub get_log_params {
$data_str = "{ data => 'Msg size is too big' }"; $data_str = "{ data => 'Msg size is too big' }";
} }
unless ($c->config->{logging}->{clear_passwords}) {
}
return { return {
tx_id => $log_tx_id, tx_id => $log_tx_id,

Loading…
Cancel
Save