-
Notifications
You must be signed in to change notification settings - Fork 87
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
[RHELC-888] Make RHSM organization and username a secret #725
Conversation
Codecov ReportBase: 92.70% // Head: 92.70% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #725 +/- ##
==========================================
- Coverage 92.70% 92.70% -0.01%
==========================================
Files 24 24
Lines 3278 3275 -3
Branches 576 575 -1
==========================================
- Hits 3039 3036 -3
Misses 172 172
Partials 67 67
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -93,8 +93,7 @@ def _set_pkg_object(self): | |||
|
|||
def _set_executed(self): | |||
"""Set how was Convert2RHEL executed""" | |||
cli_options_to_sanitize = frozenset(("--password", "-p", "--activationkey", "-k")) |
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.
No need to have the options to sanitize different for logs and breadcrumbs.
Better to keep the list just on one place.
in a transformation process where we will replace any secret values | ||
with an fixed size of asterisks (*) and returns a new list containing | ||
the arguments with this transformation. | ||
Terminology: |
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.
For clarity I've included terminology that made it easier to name variables and form a meaningful debug message.
@@ -718,16 +718,25 @@ def is_dir_empty(path): | |||
os.rmdir(path) | |||
|
|||
|
|||
def hide_secrets(args, secret_args=frozenset(("--password", "--activationkey", "--token", "-p", "-k"))): |
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've removed the "--token" because convert2rhel does not accept such an option and I don't expect it to be accepted in the future either (I don't know about any kind of token that could be utilized during the conversion).
TODO: Update related log messages after #681 gets merged (https://github.com/oamg/convert2rhel/pull/681/files#r1096154508). EDIT: Done. |
#681 is now merged, please rebase |
875fb4c
to
7d3c004
Compare
convert2rhel/utils.py
Outdated
"Passed arguments had unexpected secret argument," | ||
" '{0}', without a secret".format(sanitized_list[-1]) # lgtm[py/clear-text-logging-sensitive-data] | ||
"Passed arguments had an option, '{0}', without an expected" | ||
" secret parameter".format(sanitized_list[-1]) # lgtm[py/clear-text-logging-sensitive-data] |
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.
LGTM bot is gone so can remove this
" secret parameter".format(sanitized_list[-1]) # lgtm[py/clear-text-logging-sensitive-data] | |
" secret parameter".format(sanitized_list[-1]) |
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.
That change was not applied, @SpyTec do you want to proceed on merging this and removing the comment later?
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.
Oh, I must have missed that. I can fix it, no problem. We still have a couple other PRs left to finish, so we don't need to merge this now.
7d3c004
to
4d3aab6
Compare
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.
Failing integration tests unrelated. Can be merged
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.
Looks good in my opinion, just some small comments that should not block the PR from getting merged.
4d3aab6
to
132330d
Compare
A username and organization, the RHSM registration credentials, might be perceived as sensitive pieces of information. Having them in logs or breadcrumbs adds no additional value so better to replace it with asterisks.
132330d
to
ecd976c
Compare
@@ -78,7 +78,7 @@ def terminate_and_assert_good_rollback(c2r): | |||
# Verify the last step of the rollback is present in the log file | |||
with open("/var/log/convert2rhel/convert2rhel.log", "r") as logfile: | |||
for line in logfile: | |||
assert "Rollback: Removing installed RHSM certificate" not in line | |||
assert "Rollback: Remove installed RHSM certificate" not in line |
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.
leftover from #726
The integration test update looks good to me, @danmyway, thanks 👍 |
Will give another round of review tomorrow if this was not merged before I start working tomorrow. |
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.
Still looks good, just one question to @SpyTec if he wants to merge even without his suggestion for removing the lgtm comments was not applied.
@bocekm one question, though: Should we do the same for the pool parameter?
Otherwise, feel free to merge whenever you feel like it.
* verify that the username and organization get obfuscated in log file and bredcrumbs Signed-off-by: Daniel Diblik <[email protected]>
ecd976c
to
5aeecb1
Compare
|
||
sanitized_list.append(arg) | ||
|
||
if hide_next: | ||
loggerinst.debug( | ||
"Passed arguments had unexpected secret argument," | ||
" '{0}', without a secret".format(sanitized_list[-1]) # lgtm[py/clear-text-logging-sensitive-data] | ||
"Passed arguments had an option, '{0}', without an expected secret parameter".format(sanitized_list[-1]) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information
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 dismissed the alert, choosing that it is False positive
.
Hopefully it's enough so that others won't see this failure in other PRs.
No, because Pool IDs are random alphanumerical strings from which no one can infer anything about the subscription, and knowing the string doesn't give those without account credentials the ability to use it in any way. What we should do though is allowing to pass the username and organization through the new config file. I'll create a task for that (EDIT: here it is https://issues.redhat.com/browse/RHELC-901). |
/packit retest-failed |
@danmyway, telling Packit to retest-failed brings an unintended consequence these days - all tests are re-run, not just the failed (packit/packit-service#1886). That can lead to a situation where the ones that previously passed suddenly end up failing :) Better to re-run the failed tests manually one by one under the Checks tab. That's what I've done now for three failed jobs. |
Thanks for the heads-up @bocekm, noted! |
@danmyway, FYI I've re-run |
I'd say waive and merge if that happens again. |
Until now we've been recording and collecting the RHSM username and organization in their plain text form in the convert2rhel log files and the breadcrumbs files:
Users might perceive those values as sensitive or private information. Red Hat doesn't need this information for anything so it's better to not collect it at all.
Jira Issue: RHELC-888
Checklist
[RHELC-888]
is part of the PR titleRelease Pending