Skip to content

Commit 8f1a661

Browse files
authored
Merge pull request #6675 from thc202/authhelper/diags-storage-error
2 parents 12a02cb + 67c91d9 commit 8f1a661

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

addOns/authhelper/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
2525
### Fixed
2626
- Do not fail the authentication on diagnostic errors.
2727
- Do not configure poll authentication verification without logged in indicator.
28+
- Handle errors collecting the browser storage diagnostics.
2829

2930
## [0.27.0] - 2025-07-03
3031
### Added

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/AuthenticationDiagnostics.java

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -371,25 +371,30 @@ private static <T> T resetWait(WebDriver wd, Supplier<? extends T> function) {
371371
}
372372

373373
private void processStorage(JavascriptExecutor je, DiagnosticBrowserStorageItem.Type type) {
374-
@SuppressWarnings("unchecked")
375-
List<Map<String, String>> storage =
376-
(List<Map<String, String>>) je.executeScript(type.getScript());
377-
if (storage == null || storage.isEmpty()) {
378-
return;
379-
}
374+
try {
375+
@SuppressWarnings("unchecked")
376+
List<Map<String, String>> storage =
377+
(List<Map<String, String>>) je.executeScript(type.getScript());
378+
if (storage == null || storage.isEmpty()) {
379+
return;
380+
}
380381

381-
storage.stream()
382-
.map(
383-
e -> {
384-
DiagnosticBrowserStorageItem item = new DiagnosticBrowserStorageItem();
385-
item.setCreateTimestamp(Instant.now());
386-
item.setStep(currentStep);
387-
item.setType(type);
388-
item.setKey(e.get("key"));
389-
item.setValue(e.get("value"));
390-
return item;
391-
})
392-
.forEach(currentStep.getBrowserStorageItems()::add);
382+
storage.stream()
383+
.map(
384+
e -> {
385+
DiagnosticBrowserStorageItem item =
386+
new DiagnosticBrowserStorageItem();
387+
item.setCreateTimestamp(Instant.now());
388+
item.setStep(currentStep);
389+
item.setType(type);
390+
item.setKey(e.get("key"));
391+
item.setValue(e.get("value"));
392+
return item;
393+
})
394+
.forEach(currentStep.getBrowserStorageItems()::add);
395+
} catch (WebDriverException e) {
396+
LOGGER.debug("Failed to process the storage:", e);
397+
}
393398
}
394399

395400
private DiagnosticWebElement createDiagnosticWebElement(

0 commit comments

Comments
 (0)