<commit_before>package OpenXPKI::Dumper;

use Data::Dumper;
use Exporter 'import';
our @EXPORT = qw(SDumper);

sub SDumper {
    return Dumper CensorHash(shift);
}

sub CensorHash {
    my $data = shift;
    return $data unless(ref $data eq 'HASH');
    my @wordlist = ('_password','_private_key');
    my %out = map {
        my $vv = $data->{$_};
        my $kk = $_;
        if (grep { $_ eq $kk } @wordlist) {
            ($kk => 'sensitive content');
        } elsif (ref $vv eq 'HASH') {
            my %int = map {
                my $ki = $_;
                if (grep { $_ eq $ki } @wordlist) {
                    ($ki => 'sensitive content')
                } else {
                    ($ki => $vv->{$ki});<commit_msg>Filter 'password' in secure dumper<commit_after>package OpenXPKI::Dumper;

use Data::Dumper;
use Exporter 'import';
our @EXPORT = qw(SDumper);

sub SDumper {
    return Dumper CensorHash(shift);
}

sub CensorHash {
    my $data = shift;
    return $data unless(ref $data eq 'HASH');
    my @wordlist = ('password','_password','_private_key');
    my %out = map {
        my $vv = $data->{$_};
        my $kk = $_;
        if (grep { $_ eq $kk } @wordlist) {
            ($kk => 'sensitive content');
        } elsif (ref $vv eq 'HASH') {
            my %int = map {
                my $ki = $_;
                if (grep { $_ eq $ki } @wordlist) {
                    ($ki => 'sensitive content')
                } else {
                    ($ki => $vv->{$ki});
{'fraction_non_alphanumeric': 0.16174496644295303, 'fraction_numerical': 0.0, 'mean_word_length': 1.7973733583489682, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6620929', 'n_tokens_mistral': 496, 'n_tokens_neox': 481, 'n_words': 135}