Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
x-xss-protection
Advanced tools
Readme
The X-XSS-Protection
HTTP header aimed to offer a basic protection against cross-site scripting (XSS) attacks. However, you probably should disable it, which is what this middleware does.
Many browsers have chosen to remove it because of the unintended security issues it creates. Generally, you should protect against XSS with sanitization and a Content Security Policy. For more, read this GitHub issue.
This middleware sets the X-XSS-Protection
header to 0
. For example:
const xXssProtection = require("x-xss-protection");
// Set "X-XSS-Protection: 0"
app.use(xXssProtection());
If you truly need the legacy behavior, you can write your own simple middleware and avoid installing this module. For example:
// NOTE: This is probably insecure!
app.use((req, res, next) => {
res.setHeader("X-XSS-Protection", "1; mode=block");
next();
});
FAQs
Middleware to disable the X-XSS-Protection header
The npm package x-xss-protection receives a total of 400,053 weekly downloads. As such, x-xss-protection popularity was classified as popular.
We found that x-xss-protection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.