pkgsitegolang.org/x/pkgsite/internal/sanitizer Index | Files

package sanitizer

import "golang.org/x/pkgsite/internal/sanitizer"

Package sanitizer provides a simple html sanitizer to remove tags and attributes that could potentially cause security issues.

Index

Functions

func SanitizeBytes

func SanitizeBytes(b []byte) []byte

SanitizeBytes returns a sanitized version of the input. It throws out any attributes or tags that are not explicitly allowed in allowElems or allowAttributes below, including any child nodes of elements that are not allowed. It returns the empty string if there was an error parsing the input.

Source Files

sanitizer.go

Version
v0.0.0-20250218150137-224a1368cf02 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
2 months ago

Tools for package owners.