Security Hub

Bring your software development workflows to security

Jade

Jade XSS

Signals & Triggers

On Jade template rendering
If malicious user input not escaped in the response

Actions

  • Escape executable html code
  • Send a slack notification Send a Slack notification
  • Send an email notification Send an email notification
  • POST to webhook
  • Log request stack trace

Details

A Cross-site Scripting (XSS) allows an attacker to inject a script into the content of a website or app. When a user visits the infected page the script will execute in the victim’s browser. This allows attackers to steal private information like cookies, account information etc.

There are two types of XSS: reflected XSS and stored XSS. A reflected XSS (or also called a non-persistent XSS attack) happens when a malicious script is reflected off to another website through the victim’s browser. It’s often injected through the query string. The XSS vulnerability can then just be exploited by making a user click on a link. A stored XSS (or persistent XSS) takes place when the malicious script is injected directly into the vulnerable web application.

The Jade XSS plugin protects applications and users from reflected XSS.

Advanced details

When the application starts, Sqreen library hooks the unsafe methods of the Jade templating engine in order to catch data about to be rendered in the HTML page.

The plugin checks if the user input can execute arbitrary JavaScript in the context of the rendered page. If it can, Sqreen will trigger this plugin and perfom the requested action. The page will always be rendered to your users.

If the Escape executable html code action is selected, Sqreen will perform HTML encoding on the malicious user input: special characters like <script> are encoded into &lt;script&gt; without impacting the Jade rendering to users.

Language support

  • Node.js

Data collected by Sqreen

Signals

No data collected


On attack
  • Malicious user inputs
  • Stack trace
  • HTTP request context

Built for developers and modern apps

Get up and running in minutes just by installing our lightweight library. Enable plugins in just a couple of clicks.

  • Node.js
  • Ruby
  • PHP
  • Python
  • Java
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

$ npm install --save sqreen

$ echo '{ "token": "your token" }' > sqreen.json

 

// This should be the first line of your app

require('sqreen');

$ echo "gem 'sqreen'" >> Gemfile

$ bundle install

$ echo "token: your token" >> config/sqreen.yml

$ curl -s https://8dc0b36f0ea6f2f21b721765e10a7e02768cd1825b4551f4:@packagecloud.io/install/repositories/sqreen/sqreen/script.deb.sh | bash

$ apt-get install --no-install-recommends sqreen-agent sqreen-php-extension

$ /usr/lib/sqreen/sqreen-installer config {your token}

$ pip install sqreen

$ echo -e '[sqreen]\ntoken: your token' >> sqreen.ini

 

# Insert at the top of your app file (typically wsgi.py or app.py)

import sqreen

sqreen.start()

$ curl https://download.sqreen.io/java/sqreen-latest-all.jar -o sqreen-latest-all.jar

 

// Next, edit the JVM startup file:

-javaagent:/path/to/sqreen-agent.jar -Dsqreen.token={{your token}}

Build amazing products. Keep them safe.

3 min installation · Try all features for 7 days · No credit card required Get started Request demo