-
Notifications
You must be signed in to change notification settings - Fork 74
[SLES-16.0] Do not log the URL password in the "inst.install_url" boot parameter (bsc#1258701) #3214
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
[SLES-16.0] Do not log the URL password in the "inst.install_url" boot parameter (bsc#1258701) #3214
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,9 @@ | |
| # find current contact information at www.suse.com. | ||
|
|
||
| require "logger" | ||
| require "yast" | ||
|
|
||
| Yast.import "URL" | ||
|
|
||
| module Agama | ||
| # This class is responsible for reading Agama kernel cmdline options | ||
|
|
@@ -37,6 +40,20 @@ def initialize(data = {}) | |
| @data = data | ||
| end | ||
|
|
||
| def to_s | ||
| data_log = data | ||
|
|
||
| # optimization, hide the password only if it could be there | ||
| if data && data["install_url"] && data["install_url"].include?("@") | ||
| data_log = data.clone | ||
| data_log["install_url"] = Yast::URL.HidePassword(data["install_url"]) | ||
| end | ||
|
|
||
| "#<#{self.class.name}:0x#{object_id.to_s(16).rjust(16, "0")} @data=#{data_log.inspect}>" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious to know how we know that it is always #...0x
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| end | ||
|
|
||
| alias_method :inspect, :to_s | ||
|
|
||
| def self.read | ||
| read_from("/run/agama/cmdline.d/agama.conf") | ||
| end | ||
|
|
||
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.
NP: I wonder why not call this directly without the include optimization that it is already done by Yast::URL.HidePassword. I guess to avoid the RegExp execution, but I'm not sure if it worth.
Also, checking the Yast::URL.HidePassword I have realize that now we have "FILTERED" in some places and "PASSWORD" in others. Would be nice to been able to pass the desired mask to Yast::URL.HidePassword 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.
Yes, I noticed that different replacement. But as this code is for 16.0 only and not used in the future (for 16.1 it was rewritten to Rust) I'd not waste much time here. Just fix the problem in an easy way and be done with that.
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.
Thanks for the info, much appreciated.. I didn't know these details and I didn't pay attention that was a PR against 16.0.