From 882963615df1980ff5bfd2b697bfb3615cef4579 Mon Sep 17 00:00:00 2001 From: Per Magnus Petersen Date: Fri, 18 Sep 2026 15:10:34 +0000 Subject: [PATCH] Redact secrets from startup error logs (#4) Co-authored-by: Per Magnus Petersen --- src/clj/pmagnus/elprice/core.clj | 9 ++++++--- test/clj/pmagnus/elprice/core_test.clj | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/clj/pmagnus/elprice/core.clj b/src/clj/pmagnus/elprice/core.clj index 9d364db..a661f22 100644 --- a/src/clj/pmagnus/elprice/core.clj +++ b/src/clj/pmagnus/elprice/core.clj @@ -19,9 +19,12 @@ ;; log uncaught exceptions in threads (Thread/setDefaultUncaughtExceptionHandler (fn [thread ex] - (log/error {:what :uncaught-exception - :exception ex - :where (str "Uncaught exception on" (.getName thread))}))) + ;; Integrant exceptions include component configuration in ex-data. Logging + ;; the exception object can therefore disclose database or cookie secrets. + (log/error {:what :uncaught-exception + :exception-class (.getName (class ex)) + :message (.getMessage ex) + :where (str "Uncaught exception on " (.getName thread))}))) (defonce system (atom nil)) diff --git a/test/clj/pmagnus/elprice/core_test.clj b/test/clj/pmagnus/elprice/core_test.clj index 01c09cb..ffc778f 100644 --- a/test/clj/pmagnus/elprice/core_test.clj +++ b/test/clj/pmagnus/elprice/core_test.clj @@ -3,5 +3,6 @@ [clojure.test :refer [deftest is]] [pmagnus.elprice.core :as core])) + (deftest system-state-is-managed-in-an-atom (is (instance? clojure.lang.Atom core/system)))