secure

package
v0.0.0-...-ba52af2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFMiddleware

func CSRFMiddleware() buffalo.MiddlewareFunc

CSRFMiddleware wraps Buffalo's CSRF middleware with better defaults

func Middleware

func Middleware(opts Options) buffalo.MiddlewareFunc

Middleware returns security middleware for Buffalo

func RateLimitMiddleware

func RateLimitMiddleware(requestsPerMinute int) buffalo.MiddlewareFunc

RateLimitMiddleware provides basic rate limiting

Types

type Options

type Options struct {
	// DevMode disables some security features for development
	DevMode bool

	// ContentTypeOptions sets X-Content-Type-Options header
	ContentTypeNosniff bool

	// FrameOptions sets X-Frame-Options header
	FrameDeny       bool
	FrameSameOrigin bool

	// XSSProtection sets X-XSS-Protection header
	XSSProtection bool

	// ContentSecurityPolicy sets CSP header
	ContentSecurityPolicy string

	// StrictTransportSecurity sets HSTS header
	STSSeconds           int64
	STSIncludeSubdomains bool
	STSPreload           bool

	// ReferrerPolicy sets Referrer-Policy header
	ReferrerPolicy string
}

Options configures the security middleware

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns secure defaults

Jump to

Keyboard shortcuts

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