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.
koa-rewrite
Advanced tools
URL rewrite middleware for koa.
Notice: koa-rewrite@2+
supports koa@2
, if you want to use this module with koa@1
, please use koa-rewrite@1
.
$ npm install koa-rewrite
Rewrite using a regular expression, rewriting
/i123
to /items/123
.
app.use(rewrite(/^\/i(\w+)/, '/items/$1'));
Rewrite using route parameters, references may be named
or numeric. For example rewrite /foo..bar
to /commits/foo/to/bar
:
app.use(rewrite('/:src..:dst', '/commits/$1/to/$2'));
app.use(rewrite('/:src..:dst', '/commits/:src/to/:dst'));
You may also use the wildcard *
to soak up several segments,
for example /js/vendor/jquery.js
would become /public/assets/js/vendor/jquery.js
:
app.use(rewrite('/js/(.*)', '/public/assets/js/$1'));
Use the DEBUG environment variable with "koa-rewrite":
koa-rewrite rewrite /i123 -> /items/123 +762ms
koa-rewrite rewrite /i321 -> /items/321 +9s
koa-rewrite rewrite /i123 -> /items/123 +5s
MIT
FAQs
URL rewrite middleware for koa
The npm package koa-rewrite receives a total of 4,534 weekly downloads. As such, koa-rewrite popularity was classified as popular.
We found that koa-rewrite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers 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.