WIP -- How would we hide the display on /tests/$id#settings pages? -- Add support for configurable secrets variables#5691
Conversation
lib/OpenQA/Log.pm
Outdated
| sub redact_settings ($vars) { | ||
| return {map { $_ !~ qr/(^_SECRET_|_PASSWORD)/ ? ($_ => $vars->{$_}) : ($_ => '[redacted]') } keys %$vars}; | ||
| my $hide_re = '^_SECRET_|_PASSWORD'; | ||
| $hide_re .= "|$vars->{_HIDE_MATCH_RE}" if $vars->{_HIDE_MATCH_RE}; |
There was a problem hiding this comment.
I would make it a separate regex and also handle errors in case _HIDE_MATCH_RE doesn't contain a valid regex (in which case our default regexes should at least still be applied but some kind of user visible error would be great as well).
There was a problem hiding this comment.
I would be a bit more verbose with the variable name:
| $hide_re .= "|$vars->{_HIDE_MATCH_RE}" if $vars->{_HIDE_MATCH_RE}; | |
| $hide_re .= "|$vars->{_HIDE_SECRETS_REGEX}" if $vars->{_HIDE_SECRETS_REGEX}; |
(This is clearer then the abbreviation "re". Considering we are hiding secrets here I would replace "match" with "secrets".)
There was a problem hiding this comment.
Both suggestions covered including the fallback to ignore the additional custom stuff and still apply the default. I am still doing a concatenation to form the final regex. With more procedural code we could also use if /$default_re/ || /$custom_re/ but IMHO it wouldn't be better. WDYT?
17ac889 to
3b7630f
Compare
1418f00 to
3b7630f
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
2cf6b78 to
171a33d
Compare
11d7f5e to
31d7f10
Compare
31d7f10 to
90b4683
Compare
… Add support for configurable secrets variables Related progress issue: https://progress.opensuse.org/issues/162086
90b4683 to
ec07446
Compare
Related progress issue: https://progress.opensuse.org/issues/162086