Skip to content

Introduce ZAPDiff Action and Refactor ZAPDiff CLI#64

Merged
AryaHassanli merged 18 commits into
project-chip:mainfrom
AryaHassanli:zapdiff
Apr 15, 2026
Merged

Introduce ZAPDiff Action and Refactor ZAPDiff CLI#64
AryaHassanli merged 18 commits into
project-chip:mainfrom
AryaHassanli:zapdiff

Conversation

@AryaHassanli
Copy link
Copy Markdown
Contributor

This PR introduces the ZAPDiff action to compare ZAP XML configuration files using ZAPDiff CLI and generate reports (CSV and rich HTML). The CLI part was already merged previously.

Changes

Core Logic (zapdiff package)

  • Added support for side-by-side diffs in the HTML report.
  • Fixed CSV writer error handling by checking Flush() errors in csv.go.

UI/Report

  • Created a Handlebars template for the HTML report with a rich interface.
  • Added sorting, filtering, and a diff modal to the HTML report.
  • Fixed level filtering and polished the UI.

Action

  • Added zapdiff action to cmd/action combining ZAP Generation and ZAPDiff CLI.

@AryaHassanli AryaHassanli requested a review from a team as a code owner April 15, 2026 14:35
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new ZAPDiff action and CLI command to compare ZAP XML files, generating reports in CSV and HTML formats. It includes logic to extract specific XML elements for visual diffing in the HTML report and refactors element identification to use a more descriptive 'Entity Unique Identifier.' Feedback focuses on several issues in the XML parsing and diffing logic, such as a regex that fails to handle text() functions, fragile string-based matching for child elements, and incorrect handling of multi-line self-closing tags. Additionally, the HTML report generation contains a performance bottleneck due to redundant file I/O and an incorrect calculation for unified diff hunk headers. The priority level for missing files was also noted as being incorrectly set to the lowest severity.

Comment thread zapdiff/diff.go Outdated
Comment thread zapdiff/html.go Outdated
Comment thread zapdiff/diff.go Outdated
Comment thread zapdiff/diff.go Outdated
Comment thread zapdiff/html.go Outdated
Comment thread zapdiff/xml_mismatch.go
@AryaHassanli AryaHassanli merged commit 0ba81dd into project-chip:main Apr 15, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant