Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/bettercode-oss/gin-middleware-xss

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/bettercode-oss/gin-middleware-xss

  • v0.0.2
  • Source
  • Go
  • Socket score

Version published
Created
Source

Build Status codecov GitHub go.mod Go version GitHub release (latest SemVer)

XSS(Cross Site Scripting) Gin Middleware

It is a gin middleware that prevents XSS attacks based on bluemonday.

Usage

Start using it

Download and install it:

go get github.com/bettercode-oss/gin-middleware-xss

Import it in your code:

import "github.com/bettercode-oss/gin-middleware-xss"

Example

package main

import (
  "github.com/gin-gonic/gin"
  xss "github.com/bettercode-oss/gin-middleware-xss"
  "net/http"
)

func main() {
  r := gin.Default()
  r..Use(xss.Sanitizer(xss.Config{
		TargetHttpMethods: []string{http.MethodPost, http.MethodPut},
		UrlsToExclude:     []string{"/login"},
	}))
  r.Run()
}

FAQs

Package last updated on 03 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc