
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
nestjs-api-keys
Advanced tools
A NestJS API keys utility which allows you to secure APIs using an API Key based system.
This library only works in APIs made with NestJS.
Install the package using:
npm i nestjs-api-keys
or
yarn add nestjs-api-keys
First, you need to register the ApiKeysModule. You can do that by going to your AppModule and calling the register static method of the ApiKeysModule class:
@Module({
imports: [
ApiKeysModule.register({
apiKeys: [],
}),
],
})
export class AppModule {}
In the apiKeys array you need to provide all available API Keys.
ApiKeysModule.register({
apiKeys: [
{
name: 'For reading users', // Descriptive name
keys: ['supersecretapikey'], // API keys composing this key
permissions: ['users.read'], // Permissions given to this key
},
],
}),
REMEMBER: it is recommended that you DON'T provide directly here these values in production. You should get keys from a .ENV file or any other secure source.
In production you should (for example):
ApiKeysModule.register({
apiKeys: JSON.parse(process.env.API_KEYS_JSON_STRING),
}),
You can secure any endpoint by using the ApiKeyGuard guard:
@UseGuards(
ApiKeyGuard({
permissions: ['users.read'],
}),
)
@Get('users')
async getUsers() {
// Fetch users
}
FAQs
A NestJS utility that allows API keys based security
The npm package nestjs-api-keys receives a total of 11 weekly downloads. As such, nestjs-api-keys popularity was classified as not popular.
We found that nestjs-api-keys demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.