Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
connect-block-hotlinks
Advanced tools
I wrote this middleware to keep people from embedding my site's images into their own sites.
It compares the HTTP headers Host
and Referer
to make sure they are from the same 2nd-level domain.
For example, if Host is img.example.com
then referer can be http://example.com/
or http://blog.example.com/
but not http://another.com/
.
This will not stop a determined attacker! For that you should use CORS and authentication mechanisms. But it will prevent people stealing your bandwidth by using a URL to your image in the 'src' of an tag on another site.
It follows a classic Connect/Express middleware pattern:
var express = require('express');
var blockHotlinks = require('connect-block-hotlinks');
var app = express();
app.use "/img/*", blockHotlinks
Depending on the request, the middleware will either:
FAQs
Middleware for blocking cross-origin requests (hotlinks)
The npm package connect-block-hotlinks receives a total of 0 weekly downloads. As such, connect-block-hotlinks popularity was classified as not popular.
We found that connect-block-hotlinks 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.