Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exim: Fix Sites Tree export #6232

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tenaz3
Copy link
Contributor

@tenaz3 tenaz3 commented Feb 27, 2025

Overview

ZAP Exim Add-on: Fix for Node Names with Newlines and Special Characters

Purpose

To fix an issue in the ZAP (Zed Attack Proxy) exim add-on where the Sites Tree export functionality was not correctly handling node names that contain newlines and special characters. This caused problems when exporting and then importing site trees with complex node names.

Goals

Ensure proper preservation of newlines and special characters in node names during export/import

Changes Made

YAML Configuration Improvement:
Modified the YAML configuration in SitesTreeHandler.java to use LITERAL scalar style instead of DOUBLE_QUOTED
Created a shared createYaml() method for consistent YAML configuration between export and import operations

Deeply nested paths
Node names with special characters and spaces
Long URLs with encoded characters
Various HTTP methods and response codes

Related Issues

Fixes zaproxy/zaproxy#8858

Checklist

  • Update help
  • Update changelog
  • Run ./gradlew spotlessApply for code formatting
  • Write tests
  • Check code coverage
  • Sign-off commits
  • Squash commits
  • Use a descriptive title

For more details, please refer to the developer rules and guidelines.

@thc202 thc202 changed the title WIP: Fix yaml parser for multiline key [WIP] exim: Fix Sites Tree export Feb 27, 2025
@psiinon
Copy link
Member

psiinon commented Feb 27, 2025

Logo
Checkmarx One – Scan Summary & Detailse3ccd4cb-abb5-4af4-8dc5-083436650fe2

Great job, no security vulnerabilities found in this Pull Request

@tenaz3 tenaz3 force-pushed the exim-export-malformed-yaml branch from 0181958 to 7aaba7d Compare March 7, 2025 19:45
@tenaz3 tenaz3 changed the title [WIP] exim: Fix Sites Tree export exim: Fix Sites Tree export Mar 7, 2025
@tenaz3 tenaz3 force-pushed the exim-export-malformed-yaml branch from 7aaba7d to 615db38 Compare March 10, 2025 13:27
Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

LGTM

@thc202
Copy link
Member

thc202 commented Mar 12, 2025

The proposed fix seems overly complex/convoluted, IMO it would be better to just use a higher-level library instead (like we do in other places of the codebase).

@tenaz3
Copy link
Contributor Author

tenaz3 commented Mar 12, 2025

The proposed fix seems overly complex/convoluted, IMO it would be better to just use a higher-level library instead (like we do in other places of the codebase).

@thc202 can you point me out where I can find those examples? Which library? I could adapt the pr.

@thc202
Copy link
Member

thc202 commented Mar 12, 2025

Any that uses YAMLMapper.

@tenaz3
Copy link
Contributor Author

tenaz3 commented Mar 13, 2025

YAMLMapper

@thc202 I applied the change in another commit to be easy to check. Let me know what do you think. That also had a correct yml for one of my targets

@tenaz3 tenaz3 force-pushed the exim-export-malformed-yaml branch from 1ed7b29 to c8d4e0d Compare March 17, 2025 13:05
@tenaz3 tenaz3 requested review from thc202 and kingthorin March 17, 2025 16:32
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.

Sites Tree export might create malformed YAML data
4 participants