Skip to content

client: persist client map - #7371

Draft
thc202 wants to merge 1 commit into
zaproxy:mainfrom
thc202:client/map-persist
Draft

client: persist client map#7371
thc202 wants to merge 1 commit into
zaproxy:mainfrom
thc202:client/map-persist

Conversation

@thc202

@thc202 thc202 commented May 19, 2026

Copy link
Copy Markdown
Member

Persist the client map to the session.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds persistence for the Client Map by introducing database tables/entities for map nodes/components and wiring the ClientMap lifecycle to load/save map state with the session database.

Changes:

  • Added JDO entities + DAO (ClientMapNode, ClientMapComponent, ClientMapDao) and Flyway migration to store client map nodes/components.
  • Replaced reportedObjectConsumer with a broader PersistenceConsumer in ClientMap, and integrated it in ExtensionClientIntegration to persist map updates and reload on startup/session changes.
  • Added/updated unit tests to cover DAO conversions and new persistence consumer callbacks.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
addOns/client/src/test/java/org/zaproxy/addon/client/internal/db/ClientMapDaoUnitTest.java New unit tests for DAO conversion and null-PMF behavior.
addOns/client/src/test/java/org/zaproxy/addon/client/internal/ClientMapUnitTest.java Updated tests for the new PersistenceConsumer and publish-events toggling.
addOns/client/src/main/resources/META-INF/persistence.xml Registers new persistence-capable classes.
addOns/client/src/main/resources/db/migration/V2__Create_map_tables.sql Adds DB tables for persisted client map nodes/components.
addOns/client/src/main/java/org/zaproxy/addon/client/ui/ClientMapPanel.java Adds attach/detach helpers to swap the tree model during bulk load.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/db/ClientMapNode.java New persisted entity for map nodes.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/db/ClientMapDao.java New DAO for persisting/loading/updating/deleting nodes/components.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/db/ClientMapComponent.java New persisted entity for node components.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideDetails.java Makes setContentLoaded public for reload-from-DB.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientSideComponent.java Adds persistenceId and replaces Lombok all-args ctor with explicit ctor.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientNode.java Adds persistenceId to track DB identity per node.
addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientMap.java Introduces PersistenceConsumer, persistence hooks, and a publish-events toggle.
addOns/client/src/main/java/org/zaproxy/addon/client/ExtensionClientIntegration.java Hooks persistence into the extension lifecycle; loads map from DB; deletes DB entries on node deletion.
addOns/client/CHANGELOG.md Notes the new persisted client map feature.

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

Comment thread addOns/client/src/main/java/org/zaproxy/addon/client/internal/ClientMap.java Outdated
@psiinon

psiinon commented May 19, 2026

Copy link
Copy Markdown
Member

Logo
Checkmarx One – Scan Summary & Details0e33fd6e-5125-4cec-8024-b0d7dbe00e99

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

@thc202
thc202 force-pushed the client/map-persist branch 2 times, most recently from 92a600a to 072dea2 Compare June 1, 2026 19:12
@thc202
thc202 marked this pull request as ready for review June 2, 2026 09:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Persist the client map to the session.

Signed-off-by: thc202 <thc202@gmail.com>
@thc202
thc202 force-pushed the client/map-persist branch from 072dea2 to be788f5 Compare June 2, 2026 13:52

@kingthorin kingthorin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still LGTM

@thc202
thc202 marked this pull request as draft June 3, 2026 09:27
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.

4 participants