Create xss-serialize-javascript.yaml

patch-1
Prince Chaddha 2022-12-22 16:33:46 +05:30 committed by GitHub
parent 206e6730b2
commit df72420cb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
id: xss-serialize-javascript
info:
name: XSS Serialize Javascript
author: me_dheeraj (https://twitter.com/Dheerajmadhukar)
severity: info
description: Untrusted user input reaching `serialize-javascript` with `unsafe` attribute can cause Cross Site Scripting (XSS).
tags: file,nodejs,serialize,xss
file:
- extensions:
- all
matchers:
- type: regex
regex:
- "\\$S = require\\('serialize-javascript'\\)"
- "\\$S\\(..., {unsafe: true}\\)"
condition: or
- type: regex
negative: true
regex:
- "escape\\(...\\)"
- "encodeURI\\(...\\)"
condition: or