diff --git a/addOns/authhelper/CHANGELOG.md b/addOns/authhelper/CHANGELOG.md index fcfd8bb084..591a60c8da 100644 --- a/addOns/authhelper/CHANGELOG.md +++ b/addOns/authhelper/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Do not fail the authentication on diagnostic errors. - Do not configure poll authentication verification without logged in indicator. +- Handle errors collecting the browser storage diagnostics. ## [0.27.0] - 2025-07-03 ### Added diff --git a/addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/AuthenticationDiagnostics.java b/addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/AuthenticationDiagnostics.java index b589ea699c..b2a49b3b90 100644 --- a/addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/AuthenticationDiagnostics.java +++ b/addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/AuthenticationDiagnostics.java @@ -371,25 +371,30 @@ private static T resetWait(WebDriver wd, Supplier function) { } private void processStorage(JavascriptExecutor je, DiagnosticBrowserStorageItem.Type type) { - @SuppressWarnings("unchecked") - List> storage = - (List>) je.executeScript(type.getScript()); - if (storage == null || storage.isEmpty()) { - return; - } + try { + @SuppressWarnings("unchecked") + List> storage = + (List>) je.executeScript(type.getScript()); + if (storage == null || storage.isEmpty()) { + return; + } - storage.stream() - .map( - e -> { - DiagnosticBrowserStorageItem item = new DiagnosticBrowserStorageItem(); - item.setCreateTimestamp(Instant.now()); - item.setStep(currentStep); - item.setType(type); - item.setKey(e.get("key")); - item.setValue(e.get("value")); - return item; - }) - .forEach(currentStep.getBrowserStorageItems()::add); + storage.stream() + .map( + e -> { + DiagnosticBrowserStorageItem item = + new DiagnosticBrowserStorageItem(); + item.setCreateTimestamp(Instant.now()); + item.setStep(currentStep); + item.setType(type); + item.setKey(e.get("key")); + item.setValue(e.get("value")); + return item; + }) + .forEach(currentStep.getBrowserStorageItems()::add); + } catch (WebDriverException e) { + LOGGER.debug("Failed to process the storage:", e); + } } private DiagnosticWebElement createDiagnosticWebElement(