-
Notifications
You must be signed in to change notification settings - Fork 92
refactor(calm-hub): use centralized strict sanitization policy to prevent XSS #1859
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||
| package org.finos.calm.resources; | ||||||
|
|
||||||
| import org.junit.jupiter.api.Assertions; | ||||||
| import org.junit.jupiter.api.Test; | ||||||
| import org.owasp.html.PolicyFactory; | ||||||
|
|
||||||
| public class TestSanitizationSecurityShould { | ||||||
|
|
||||||
| @Test | ||||||
| public void withstandNoscriptStyleInjectionAttack() { | ||||||
|
||||||
| public void withstandNoscriptStyleInjectionAttack() { | |
| public void withstand_noscript_style_injection_attack() { |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Test method names in this codebase use snake_case rather than camelCase. Consider renaming to act_as_strict_policy for consistency with other test files.
| public void actAsStrictPolicy() { | |
| public void act_as_strict_policy() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using a static import for
STRICT_SANITIZATION_POLICYinstead of creating a local constant that references it. This would be more consistent with howPatternResourceuses the same constant (see line 26 of PatternResource.java).Current approach:
Suggested approach:
This would eliminate the redundant local constant and align with the existing codebase pattern.