refactor(calm-hub): use centralized strict sanitization policy to prevent XSS#1860
Merged
jpgough-ms merged 3 commits intofinos:mainfrom Nov 27, 2025
Merged
Conversation
…vent XSS Refactors CoreSchemaResource to use ResourceValidationConstants.STRICT_SANITIZATION_POLICY instead of creating a new policy instance. This ensures consistent application of security policies. Adds a regression test TestSanitizationSecurityShould to verify immunity against OWASP HtmlPolicyBuilder XSS vulnerability involving noscript and style tags.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the security sanitization approach in the CALM Hub to use a centralized policy, improving maintainability and consistency. The changes address a potential XSS vulnerability highlighted in a security advisory by ensuring all sanitization uses the same strict policy configuration defined in ResourceValidationConstants.
Key Changes:
- Refactored
CoreSchemaResourceto reference the centralizedResourceValidationConstants.STRICT_SANITIZATION_POLICYinstead of creating a local policy instance - Added comprehensive regression tests verifying immunity against OWASP HtmlPolicyBuilder XSS vulnerabilities involving noscript and style tags
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
calm-hub/src/main/java/org/finos/calm/resources/CoreSchemaResource.java |
Refactored to use centralized sanitization policy constant |
calm-hub/src/test/java/org/finos/calm/resources/TestSanitizationSecurityShould.java |
Added security regression tests for XSS attack vectors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
calm-hub/src/test/java/org/finos/calm/resources/TestSanitizationSecurityShould.java
Outdated
Show resolved
Hide resolved
…onSecurityShould.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jpgough-ms
approved these changes
Nov 27, 2025
rocketstack-matt
added a commit
to rocketstack-matt/architecture-as-code
that referenced
this pull request
Nov 28, 2025
…vent XSS (finos#1860) * refactor(calm-hub): use centralized strict sanitization policy to prevent XSS Refactors CoreSchemaResource to use ResourceValidationConstants.STRICT_SANITIZATION_POLICY instead of creating a new policy instance. This ensures consistent application of security policies. Adds a regression test TestSanitizationSecurityShould to verify immunity against OWASP HtmlPolicyBuilder XSS vulnerability involving noscript and style tags. * chore: Remove blank lines between imports in CoreSchemaResource.java * Update calm-hub/src/test/java/org/finos/calm/resources/TestSanitizationSecurityShould.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Security advisory https://github.com/finos/architecture-as-code/security/dependabot/112 highlights a potential XSS issue, analysis shows this is not an issue with the current implementation, but also that there are a couple of small improvements we could make, which are in this PR.
Refactors CoreSchemaResource to use ResourceValidationConstants.STRICT_SANITIZATION_POLICY
instead of creating a new policy instance. This ensures consistent application of security policies.
Adds a regression test TestSanitizationSecurityShould to verify immunity against
OWASP HtmlPolicyBuilder XSS vulnerability involving noscript and style tags.
Type of Change
Affected Components
cli/)shared/)calm-widgets/)calm-hub/)calm-hub-ui/)docs/)calm-plugins/vscode/)Commit Message Format ✅
Testing
Checklist