From 29da89cefd6243e7cf2c1c0035d2e48c73ae6fe2 Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 11 Nov 2025 17:28:58 -0500 Subject: [PATCH] Add history reload after file cleaning to prevent re-adding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Add history -c && history -r after cleaning file - Reloads cleaned history into current session - Prevents bash from appending dirty history on shell exit Issue: - Trace eraser cleaned file but current session kept dirty history - On shell exit, bash appended current session to file - All curl commands were re-added to ~/.bash_history Solution: - After cleaning file, clear and reload current session history - Current session now has only cleaned history - On exit, only clean commands are appended Tested: ✓ File cleaned with grep -Ev ✓ Current session reloaded from cleaned file --- tools/erase-toolkit-traces.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/erase-toolkit-traces.sh b/tools/erase-toolkit-traces.sh index 685c5f0..8182891 100755 --- a/tools/erase-toolkit-traces.sh +++ b/tools/erase-toolkit-traces.sh @@ -167,11 +167,15 @@ if [ "$CLEAN_HISTORY" = true ] && [ -f ~/.bash_history ]; then echo " ✓ History file cleaned" fi + # Reload cleaned history into current session to prevent re-adding on exit + echo " → Reloading cleaned history into current session..." + history -c + history -r + echo " ✓ In-memory history reloaded from cleaned file" echo "" - echo "NOTE: Other active terminal sessions may still have old history in memory." - echo " Run 'exec bash' or 'history -c && history -r' in those terminals," - echo " or simply logout/login to start completely fresh." + echo "NOTE: For complete cleanup, run 'exec bash' to start a fresh shell." + echo " This prevents any lingering history from being re-saved." fi # Offer to remove the entire toolkit (AFTER history cleaning)