Skip to content

Conversation

@RajvardhanT7747
Copy link

Description
Fixes issue #3214 by preventing unwanted formatting such as HTML entities (") and tab characters (\t) from being stored in CouchDB while saving Obligations with nested text nodes. This ensures clean data storage without changing existing business logic or UI behavior.

Root Cause
Tab characters (\t) were used for indentation in the buildObligationText() method, which resulted in control characters being persisted in CouchDB.
HTML entities (") were introduced because XssStringDeserializer encoded quotation marks before database persistence.

Changes

Backend (licenses-core)
File: LicenseDatabaseHandler.java
Replaced tab characters (\t) with two spaces in buildObligationText() to avoid persisting formatting artifacts.

REST Layer (rest-common)
File: XssStringDeserializer.java
Added missing import for StringEscapeUtils.
Introduced sanitizeWithoutEncoding() to remove XSS patterns without HTML entity encoding.
Fixed regex escaping issues.
Improved security by using case-insensitive pattern matching.

Testing
Manual testing done by checking CouchDB entries directly.
Verified that quotes are stored as " instead of ".
Confirmed that no tab characters are persisted.
XSS protection remains intact (script tags and dangerous patterns are removed).
Full integration testing will be handled by CI/CD.

Security
XSS protection is preserved using pattern-based sanitization rather than encoding.
Potentially dangerous inputs such as script tags, iframes, and inline event handlers are still blocked.
Clean text is stored in the database, with encoding deferred to rendering where applicable.

Notes
No API changes.
No UI changes.
Fix is minimal and backward compatible.

@RajvardhanT7747
Copy link
Author

hey @heliocastro ,

could you plz review my two pr's #3540 & #3541 ??

Thank you for your time.

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Dec 22, 2025
@RajvardhanT7747
Copy link
Author

Hey @GMishx
Please let me know if any changes are needed from my side.
I’m happy to address review comments or help with testing if required.

@GMishx GMishx added the has merge conflicts The PR has merge conflicts label Dec 30, 2025
Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

The PR contains changes in irrelevant lines and additional commits. Please cleanup the PR for easy review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has merge conflicts The PR has merge conflicts needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants