
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Serialize JSON data using TypeScript.
Serializing data sent from the webserver to the client shouldn't be hard. If you're already using TypeScript, you have everything you need. Scrubbr will use your TypeScript types to deeply transform and sanitize your data.
npm i -S scrubbr
The simplest example is to filter out sensitive data.
In this example we want to filter the email and password out of this sample data:
{
users: [
{
name: 'John Doe',
image: 'http://i.pravatar.cc/300',
email: 'donotspam@me.com',
password: 'xxxsecretxxx',
},
],
};
// schema.ts
type UserList = {
users: User[];
};
type User = {
name: string;
image: string;
};
import Scrubbr from 'scrubbr';
// PERFORMANCE NOTE: this is a synchronous call!
// Load early and cache to a shared variable.
const scrubbr = new Scrubbr('./schema.ts');
function api() {
const data = getUsers();
// Serialize the data based on the UserList type defined in schema.ts
return scrubbr.serialize('UserList', data);
}
{
"users": [
{
"name": "John Doe",
"image": "http://i.pravatar.cc/300"
}
]
}
To make things even easier in express, install the Scrubbr express middleware.
app.get('/users', (req, res) => {
const userData = fetchDataHere();
resp.status(200)
.scrubbr('UserList')
.send(userData);
}
Read the documentation to learn how do do more with Scrubbr.
FAQs
Serialize and sanitize JSON data using TypeScript.
The npm package scrubbr receives a total of 0 weekly downloads. As such, scrubbr popularity was classified as not popular.
We found that scrubbr 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.