sanitizer

package
v6.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

README

Sanitizer

This package provides a server for sanitizing strings by removing potentially dangerous HTML and JavaScript that may be used to execute XSS attacks.

sampleHTML := `<h1>This is a test</h1>
<script>
	alert("Hi");
</script>`

xssService := sanitizer.NewXSSService()
sanitizedHTML := xssService.SanitizeString(sampleHTML)

// New HTML == `<h1>This is a test</h1>`

Documentation

Overview

* Copyright (c) 2021. App Nerds LLC. All rights reserved

* Copyright (c) 2021. App Nerds LLC. All rights reserved

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IXSSServiceProvider

type IXSSServiceProvider interface {
	SanitizeString(input string) string
}

IXSSServiceProvider is an interface for providing cross-site scripting and sanitization services.

type XSSService

type XSSService struct {
	// contains filtered or unexported fields
}

XSSService implements the XSSServiceProvider interface and offers functions to help address cross-site script and sanitization concerns.

func NewXSSService

func NewXSSService() XSSService

NewXSSService creates a new cross-site scripting service.

func (XSSService) SanitizeString

func (service XSSService) SanitizeString(input string) string

SanitizeString attempts to sanitize a string by removing potentially dangerous HTML/JS markup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL