Package org.commonmark.renderer.html
Interface UrlSanitizer
-
- All Known Implementing Classes:
DefaultUrlSanitizer
public interface UrlSanitizer
Sanitizes urls for img and a elements by whitelisting protocols. This is intended to prevent XSS payloads like [Click this totally safe url](javascript:document.xss=true;)Implementation based on https://github.com/OWASP/java-html-sanitizer/blob/f07e44b034a45d94d6fd010279073c38b6933072/src/main/java/org/owasp/html/FilterUrlByProtocolAttributePolicy.java
- Since:
- 0.14.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
sanitizeImageUrl(java.lang.String url)
Sanitize a url for use in the src attribute of aImage
.java.lang.String
sanitizeLinkUrl(java.lang.String url)
Sanitize a url for use in the href attribute of aLink
.
-
-
-
Method Detail
-
sanitizeLinkUrl
java.lang.String sanitizeLinkUrl(java.lang.String url)
Sanitize a url for use in the href attribute of aLink
.- Parameters:
url
- Link to sanitize- Returns:
- Sanitized link
-
-