From c7b561fab7b682e11bf4e1ab28bbd1c187d366fc Mon Sep 17 00:00:00 2001 From: Stephen Lombardo Date: Tue, 28 Aug 2018 15:38:02 -0400 Subject: [PATCH] simple filtering of shell input to skip history for key and rekey statements --- src/shell.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/shell.c b/src/shell.c index 6212cb2d..93048a04 100644 --- a/src/shell.c +++ b/src/shell.c @@ -624,6 +624,15 @@ static char *one_input_line(FILE *in, char *zPrior, int isContinuation){ #else free(zPrior); zResult = shell_readline(zPrompt); +/* BEGIN SQLCIPHER */ +#ifdef SQLITE_HAS_CODEC + /* Simplistic filtering of input lines to prevent PRAGKA key and + PRAGMA rekey statements from being stored in readline history. + Note that this will only prevent single line statements, but that + will be sufficient for common cases. */ + if(sqlite3_strlike("%pragma%key%=%", zResult, 0)==0) return zResult; +#endif +/* END SQLCIPHER */ if( zResult && *zResult ) shell_add_history(zResult); #endif }