New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

hpp-clean

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hpp-clean

An up-to-date alternative to the deprecated hpp package. Express middleware to protect against HTTP Parameter Pollution Attacks.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

hpp-clean

An up-to-date alternative to the deprecated hpp package.
Express middleware to protect against HTTP Parameter Pollution Attacks.

Installation

npm install hpp-clean

Usage

const express = require('express');
const hpp = require('hpp-clean');

const app = express();

app.use(express.json());
app.use(hpp());

app.get('/', (req, res) => {
  res.json({
    query: req.query,
    queryPolluted: req.queryPolluted,
  });
});

app.post('/', (req, res) => {
  res.json({
    body: req.body,
    bodyPolluted: req.bodyPolluted,
  });
});

app.listen(3000, () => {
  console.log('Server running on http://localhost:3000');
});

Options

  • whitelist: string[] → keys allowed to keep multiple values.
  • keepFirst: boolean → if true, keeps the first value instead of the last.
app.use(hpp({
  whitelist: ["tags"],  // allow multiple values for "tags"
  keepFirst: true      // keep the first value (by default it keeps the last one)
}))

Why?

  • hpp is deprecated and doesn’t work with Express 5.
  • hpp-clean is a modern drop-in replacement.

License

MIT © 2025 Mohammad Kalhor

Keywords

express

FAQs

Package last updated on 24 Sep 2025

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