validation

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MaxCredLen     = 255  // Maximum credential length (username/password)
	MaxTokenLen    = 2048 // Maximum bearer token length
	MaxKeyLen      = 256  // Maximum query parameter key length
	MaxValueLen    = 8192 // Maximum query parameter value length
	MaxFilenameLen = 256  // Maximum filename length for uploads

	MaxCookieNameLen   = 256
	MaxCookieValueLen  = 4096
	MaxCookieDomainLen = 255
	MaxCookiePathLen   = 1024

	MaxHeaderKeyLen   = 256
	MaxHeaderValueLen = 8192
)

Common validation constants

Variables

This section is empty.

Functions

func ValidateCookieName

func ValidateCookieName(name string) error

ValidateCookieName validates HTTP cookie names.

func ValidateCookieValue

func ValidateCookieValue(value string) error

ValidateCookieValue validates HTTP cookie values.

func ValidateCredential

func ValidateCredential(cred string, maxLen int, checkColon bool, credType string) error

ValidateCredential validates credentials for Basic Auth.

func ValidateFieldName

func ValidateFieldName(name string, fieldType string) error

ValidateFieldName validates form field names and filenames.

func ValidateHeaderKeyValue

func ValidateHeaderKeyValue(key, value string) error

ValidateHeaderKeyValue validates HTTP header keys and values.

func ValidateInputString

func ValidateInputString(input string, maxLen int, name string, additionalChecks func(rune) error) error

ValidateInputString performs common string validation to prevent injection attacks.

func ValidateQueryKey

func ValidateQueryKey(key string) error

ValidateQueryKey validates query parameter keys.

func ValidateToken

func ValidateToken(token string) error

ValidateToken validates bearer tokens according to RFC 6750.

Types

This section is empty.

Jump to

Keyboard shortcuts

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