Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
express-subdomain-handler
Advanced tools
##Intro
express-subdomain-handler takes the headache out of dynamic subdomain routing in Express. It captures the contents of any subdomain and writes them into the Express req.url. This means you can write specific route handlers for subdomain urls. As you can see below, express-subdomain-handler can manage single or multiple subdomains.
##Examples
http://mysubdomain.example.com
=> '/subdomain/mysubdomain/'
http://myexcellentsubdom.example.com/homepage
=> '/subdomain/myexcellentsubdom/homepage'
http://first.second.example.com
=> '/subdomain/first/second/'
http://first.second.example.com/another/page
=> '/subdomain/first/second/another/page'
##Installation
npm install express-subdomain-handler
##Usage
Add express-subdomain-handler to your express middleware stack (before your routes are specified). You need to specify what the base url of your site is ('example.com', 'example.local', etc), what you what subdomain urls to be prefixed with ('subdomain' by default) and whether you want logging turned on (false by default)
app.use( require('express-subdomain-handler')({ baseUrl: 'example.com', prefix: 'myprefix', logger: true }) );
Setup routes to catch subdomain urls so for http://mysubdomain.example.com/homepage
I would write my route
handler to look like this.
app.get('/myprefix/:thesubdomain/thepage', function(req, res, next){
// for the example url this will print 'mysubdomain'
res.send(req.params.thesubdomain);
});
##Follow me
If you like my stuff, follow me on Twitter
FAQs
A tiny module to handle subdomains nicely in Express
The npm package express-subdomain-handler receives a total of 40 weekly downloads. As such, express-subdomain-handler popularity was classified as not popular.
We found that express-subdomain-handler 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.