
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@vercel/routing-utils
Advanced tools
@vercel/routing-utils is a utility package designed to help with routing configurations for Vercel deployments. It provides tools to define and manipulate routes, rewrites, redirects, and headers in a structured and efficient manner.
Define Routes
This feature allows you to define custom routes for your application. The 'src' field specifies the incoming request path, and the 'dest' field specifies the destination path.
{
"routes": [
{ "src": "/about", "dest": "/about.html" },
{ "src": "/blog/(.*)", "dest": "/blog/post?slug=$1" }
]
}
Rewrites
Rewrites allow you to map an incoming request path to a different destination path without changing the URL in the browser.
{
"rewrites": [
{ "source": "/old-path", "destination": "/new-path" }
]
}
Redirects
Redirects enable you to redirect an incoming request to a different URL with a specified status code, such as 301 for permanent redirects.
{
"redirects": [
{ "source": "/old-blog", "destination": "/new-blog", "statusCode": 301 }
]
}
Headers
This feature allows you to set custom headers for specific routes. The 'source' field specifies the route, and the 'headers' field contains an array of headers to be set.
{
"headers": [
{ "source": "/api/(.*)", "headers": [ { "key": "Cache-Control", "value": "no-cache" } ] }
]
}
Next.js is a React framework that provides built-in support for routing, rewrites, redirects, and headers. It offers a more comprehensive solution for building server-rendered React applications, including routing utilities similar to @vercel/routing-utils.
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. It allows you to define routes, middleware, and custom headers, but requires more manual setup compared to @vercel/routing-utils.
Koa is a new web framework designed by the team behind Express, aiming to be a smaller, more expressive, and more robust foundation for web applications and APIs. It provides similar routing capabilities but with a more modern and modular approach.
Route validation utilities
yarn add @vercel/routing-utils
import { normalizeRoutes } from '@vercel/routing-utils';
const { routes, error } = normalizeRoutes(inputRoutes);
if (error) {
console.log(error.code, error.message);
}
import { routesSchema } from '@vercel/routing-utils';
const ajv = new Ajv();
const validate = ajv.compile(routesSchema);
const valid = validate([{ src: '/about', dest: '/about.html' }]);
if (!valid) console.log(validate.errors);
FAQs
Vercel routing utilities
We found that @vercel/routing-utils demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.