Documentation
¶
Overview ¶
Package validator provides HTML validation and security checking for user content.
This package validates HTML content to ensure it's safe to store and display. It checks for:
- Script tags that could execute arbitrary JavaScript
- Event handler attributes (onclick, onload, etc.)
- Shadow DOM usage (marked by omnomshadowroot attribute)
The validator is used when importing bookmarks or snapshots to prevent XSS attacks and other security issues. It parses HTML using golang.org/x/net/html and reports any security concerns.
Example usage:
result := validator.ValidateHTML(htmlContent)
if result.Error != nil {
log.Printf("Invalid HTML: %v", result.Error)
return
}
if result.HasShadowDOM {
log.Println("Content uses Shadow DOM")
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.