Skip to content

Include output in script diagnostics#7393

Open
kingthorin wants to merge 1 commit into
zaproxy:mainfrom
kingthorin:diag-output
Open

Include output in script diagnostics#7393
kingthorin wants to merge 1 commit into
zaproxy:mainfrom
kingthorin:diag-output

Conversation

@kingthorin
Copy link
Copy Markdown
Member

@psiinon
Copy link
Copy Markdown
Member

psiinon commented May 22, 2026

Logo
Checkmarx One – Scan Summary & Details1ad252e6-6267-4013-8bcc-ba0553e05c67

Great job! No new security vulnerabilities introduced in this pull request


Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends script diagnostics to capture and report Zest print output, including attribution of each output line to the originating script within a Zest chain. It also updates persistence/reporting so successful runs with captured output can be included in reports (optionally), alongside existing failure diagnostics.

Changes:

  • Capture Zest ZestActionPrint results during execution and store them on the ZestScriptWrapper for later diagnostics/reporting (including chain attribution via provenance).
  • Persist captured output as diagnostic “OUTPUT” steps (and optionally persist SUCCESS runs when output exists), and allow reports to include these output steps via a new scriptdiagnosticsoutput section.
  • Update report template/i18n/help and add/adjust unit tests to cover output capture + persistence/query behavior.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
addOns/zest/src/test/java/org/zaproxy/zap/extension/zest/ZestZapRunnerUnitTest.java Adds unit tests for capturing print output, chain attribution, and reset behavior.
addOns/zest/src/main/java/org/zaproxy/zap/extension/zest/ZestZapRunner.java Captures print output from ZestActionPrint and clears print captures between runs/wrapper changes.
addOns/zest/src/main/java/org/zaproxy/zap/extension/zest/ZestScriptWrapper.java Stores per-run print captures and exposes them via the diagnostics interface.
addOns/zest/CHANGELOG.md Documents the new print-output capture and chain attribution behavior.
addOns/scripts/src/test/java/org/zaproxy/zap/extension/scripts/internal/db/ScriptRunReportQueryUnitTest.java Updates query test for new loadRunsForReport(boolean) signature.
addOns/scripts/src/test/java/org/zaproxy/zap/extension/scripts/internal/db/ScriptRunRecorderUnitTest.java Adds tests for persisting output steps and SUCCESS runs with output.
addOns/scripts/src/main/resources/org/zaproxy/zap/extension/scripts/resources/Messages.properties Adds i18n strings for persisted SUCCESS summaries (single + chain).
addOns/scripts/src/main/java/org/zaproxy/zap/extension/scripts/zest/ZestScriptDiagnosticSource.java Extends diagnostics interface to include print captures (default method).
addOns/scripts/src/main/java/org/zaproxy/zap/extension/scripts/report/ExtensionScriptsReport.java Enables optional inclusion of output steps via scriptdiagnosticsoutput.
addOns/scripts/src/main/java/org/zaproxy/zap/extension/scripts/internal/db/ScriptRunReportQuery.java Adds includeOutputSteps behavior and filtering for output vs error-only reporting.
addOns/scripts/src/main/java/org/zaproxy/zap/extension/scripts/internal/db/ScriptRunRecorder.java Persists output as OUTPUT-kind steps and supports persisting SUCCESS runs with output.
addOns/scripts/src/main/java/org/zaproxy/zap/extension/scripts/automation/ScriptJobOutputListener.java Captures script output lines for later persistence into diagnostics.
addOns/scripts/src/main/java/org/zaproxy/zap/extension/scripts/automation/actions/RunScriptAction.java Persists output for successful runs; includes captured output alongside failures; buckets chain output by provenance.
addOns/reports/src/main/zapHomeFiles/reports/traditional-json-plus/template.yaml Adds scriptdiagnosticsoutput section to the template.
addOns/reports/src/main/zapHomeFiles/reports/traditional-json-plus/Messages.properties Adds label for the new report section.
addOns/reports/src/main/javahelp/org/zaproxy/addon/reports/resources/help/contents/report-traditional-json-plus.html Documents the new optional output section and provides updated examples.
addOns/reports/CHANGELOG.md Updates release notes to reflect optional printed output in diagnostics reporting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
@kingthorin kingthorin marked this pull request as ready for review May 23, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants