Socket
Socket
Sign inDemoInstall

nobita-xss

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

12

lib/nobita-xss.js
module.exports = async (ctx, next) => {
ctx.request.body = ctx.request.body && JSON.parse(JSON.stringify(ctx.request.body).replace(/\</g, '&lt;').replace(/\</g, '&gt;'));
ctx.query = ctx.query && JSON.parse(JSON.stringify(ctx.query).replace(/\</g, '&lt;').replace(/\</g, '&gt;'));
if (ctx.config.xss) {
let body = Object.assign({}, ctx.request.body);
let query = Object.assign({}, ctx.query);
if(body){
ctx.request.body = JSON.parse(JSON.stringify(body).replace(/\</g, '&lt;').replace(/\</g, '&gt;'));
}
if(query){
ctx.query = JSON.parse(JSON.stringify(query).replace(/\</g, '&lt;').replace(/\</g, '&gt;'));
}
}
await next();
}

2

package.json
{
"name": "nobita-xss",
"version": "0.0.1",
"version": "0.0.2",
"description": "nobita-xss",

@@ -5,0 +5,0 @@ "main": "lib/nobita-xss.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc