Fixes 25682: Add server-side XSS sanitization for user input#25683
Fixes 25682: Add server-side XSS sanitization for user input#25683GhaziBenDahmane wants to merge 2 commits intoopen-metadata:mainfrom
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| .allowAttributes("style", "class") | ||
| .onElements("div", "span", "p", "pre", "code") |
There was a problem hiding this comment.
style attribute enables CSS-based attacks
Details
The style attribute is allowed on multiple elements (div, span, p, pre, code), which can enable CSS-based attacks. While the OWASP HTML Sanitizer provides some protection, allowing arbitrary style values can lead to:
- Data exfiltration via CSS selectors and
url()in backgrounds - UI redressing where attackers overlay fake UI elements
- User tracking through unique CSS-based fingerprinting
- Content hiding/manipulation to confuse users
Recommendation: Either remove the style attribute entirely, or use .allowStyling(CssSchema.DEFAULT) which provides safer CSS handling. If custom styling is required, consider allowlisting specific CSS properties:
.allowAttributes("style")
.matching(StyleAttributePolicy.allowedProperties("color", "font-weight", "text-align"))
.onElements("div", "span", "p", "pre", "code")Alternatively, rely on class attributes (which are already allowed) with predefined CSS classes for styling.
Was this helpful? React with 👍 / 👎
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
🔍 CI failure analysis for a37c613: All CI jobs continue to fail due to missing 'safe to test' label - no change from previous analysis.IssueAll CI jobs remain blocked and continue to fail immediately without executing any tests or builds. Root CauseThe PR is from an external contributor (GhaziBenDahmane) and still lacks the "safe to test" label required by OpenMetadata's CI security workflow. This security gate prevents unauthorized code execution in CI pipelines for external contributions. Current Status
DetailsEvery CI job continues to exit with the same error: All affected jobs (including newly analyzed failures):
ImpactNo code validation, linting, testing, or building has occurred because the security gate prevents execution. The XSS sanitization implementation remains unvalidated by CI. Code Review 👍 Approved with suggestions 0 resolved / 2 findingsGood XSS sanitization implementation using OWASP library with comprehensive test coverage. Two previous security findings remain unaddressed: the
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
Describe your changes:
Fixes 25682
Sanitization to avoid XSS is currently done in the frontend before inserting the data instead of being done in the backend, so a bad actor can insert JS code that will be executed via the api.
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>Summary by Gitar
InputSanitizerinutil/InputSanitizer.javauses OWASP HTML Sanitizer with entity link preservation via regexsanitize()at 20+ locations includingEntityRepository,FeedRepository,ColumnRepository, and entity mappersInputSanitizerTestwith 16 test cases covering XSS vectors, safe HTML preservation, and edge casesThis will update automatically on new commits.