From 81d5a3ea64dd08bdb1372a490586bdb1ba457fc1 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 30 Jul 2020 20:22:54 -0700 Subject: [PATCH] Do not add silent mode history items to history Prior to this fix, if you invoked fish with --private and then used `read --silent` to read something sensitive, the variable would be stored in history, with the plain text available through up-arrow. Fix it to not store items in silent mode. Note the item was never written to disk; it was only stored in memory. Fixes #7230 --- src/reader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 5fed037c1..177df3fbe 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -3018,9 +3018,9 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat if (command_test_result == 0) { // Finished command, execute it. Don't add items that start with a leading - // space. + // space, or if in silent mode (#7230). const editable_line_t *el = &command_line; - if (history != nullptr && may_add_to_history(el->text())) { + if (history != nullptr && !silent && may_add_to_history(el->text())) { history->add_pending_with_file_detection(el->text(), vars.get_pwd_slash()); } rls.finished = true;