Skip to content

Commit

Permalink
Merge 02efa58 into 4b41f0d
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 6, 2022
2 parents 4b41f0d + 02efa58 commit 7bbddfa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions package/yast2-bootloader.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Oct 5 21:35:19 UTC 2022 - Josef Reidinger <jreidinger@suse.com>

- prevent leak of grub2 password to logs(bsc#1201962)
- 4.3.32

-------------------------------------------------------------------
Thu Apr 7 13:21:58 UTC 2022 - Josef Reidinger <jreidinger@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-bootloader.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-bootloader
Version: 4.3.31
Version: 4.3.32
Release: 0
Summary: YaST2 - Bootloader Configuration
License: GPL-2.0-or-later
Expand Down
11 changes: 10 additions & 1 deletion src/lib/bootloader/grub2pwd.rb
Expand Up @@ -2,6 +2,7 @@

require "yast"
require "shellwords"
require "yast2/execute"

Yast.import "Stage"

Expand Down Expand Up @@ -130,7 +131,8 @@ def encrypt(password)
result = Yast::Execute.locally("/usr/bin/grub2-mkpasswd-pbkdf2",
env: { "LANG" => "C" },
stdin: "#{password}\n#{password}\n",
stdout: :capture)
stdout: :capture,
recorder: NoStdinRecorder.new(Yast::Y2Logger.instance))

pwd_line = result.split("\n").grep(/password is/).first
if !pwd_line
Expand All @@ -143,4 +145,11 @@ def encrypt(password)
ret
end
end

# Class to prevent Yast::Execute from leaking to the logs the password
# provided via stdin
class NoStdinRecorder < Cheetah::DefaultRecorder
# To prevent leaking stdin, just do nothing
def record_stdin(_stdin); end
end
end

0 comments on commit 7bbddfa

Please sign in to comment.