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

dont-sniff-mimetype

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dont-sniff-mimetype

Middleware to prevent mimetype from being sniffed

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
435K
decreased by-12.21%
Maintainers
1
Weekly downloads
 
Created

What is dont-sniff-mimetype?

The dont-sniff-mimetype npm package is a middleware for Express.js that helps prevent browsers from trying to guess (sniff) the MIME type of a response. This is important for security reasons, as MIME type sniffing can lead to security vulnerabilities such as Cross-Site Scripting (XSS) attacks.

What are dont-sniff-mimetype's main functionalities?

Set X-Content-Type-Options header

This feature sets the `X-Content-Type-Options` header to `nosniff` for all responses. This tells browsers not to perform MIME type sniffing, which helps prevent certain types of attacks.

const express = require('express');
const dontSniffMimetype = require('dont-sniff-mimetype');

const app = express();

// Use the dont-sniff-mimetype middleware
app.use(dontSniffMimetype());

app.get('/', (req, res) => {
  res.send('Hello, world!');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Other packages similar to dont-sniff-mimetype

Keywords

FAQs

Package last updated on 11 May 2019

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