-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP -- How would we hide the display on /tests/$id#settings pages? -- Add support for configurable secrets variables #5691
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
… Add support for configurable secrets variables Related progress issue: https://progress.opensuse.org/issues/162086
17ac889
to
3b7630f
Compare
1418f00
to
3b7630f
Compare
Co-authored-by: Martchus <[email protected]>
Related progress issue: https://progress.opensuse.org/issues/162086