
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@aegis-sdk/fastify
Advanced tools
Fastify plugin for scanning LLM chat messages against prompt injection attacks.
Part of the Aegis.js prompt injection defense toolkit.
npm install @aegis-sdk/fastify @aegis-sdk/core
import Fastify from 'fastify';
import { aegisPlugin } from '@aegis-sdk/fastify';
const app = Fastify();
app.register(aegisPlugin, {
aegis: { policy: 'strict' },
routes: ['/api/chat'],
});
app.post('/api/chat', async (request, reply) => {
const { messages, instance } = request.aegis; // scanned messages
// pass messages to your LLM
return { reply: '...' };
});
app.listen({ port: 3000 });
aegisPluginFastify plugin that registers a preHandler hook. The hook reads messages from the request body, runs them through aegis.guardInput(), and attaches the safe messages to request.aegis. Returns 403 with violation details if input is blocked.
Register it with app.register(aegisPlugin, options):
| Option | Type | Default | Description |
|---|---|---|---|
aegis | AegisConfig | Aegis | {} | Aegis configuration or pre-constructed instance |
routes | (string | RegExp)[] | -- | Routes to protect. If omitted, all POST requests are scanned |
methods | string[] | ["POST"] | HTTP methods to scan |
messagesProperty | string | "messages" | Property on the request body to read messages from |
scanStrategy | ScanStrategy | "last-user" | Which messages to scan |
onBlocked | (request, reply, error) => unknown | -- | Custom error handler. Return truthy to take over the response |
Access scan results in your handler via request.aegis, which returns { messages, instance, auditLog }.
aegisStreamTransform(configOrInstance?)Returns a TransformStream<string, string> that monitors LLM output tokens for injection payloads, PII leaks, and canary token leaks.
guardMessages(aegis, messages, options?)Scans messages directly without using the plugin. Throws AegisInputBlocked if input is blocked.
Aegis, AegisInputBlocked, AegisSessionQuarantined, AegisSessionTerminated, and all core types are re-exported for convenience.
MIT
FAQs
Fastify plugin adapter for Aegis prompt injection defense
The npm package @aegis-sdk/fastify receives a total of 11 weekly downloads. As such, @aegis-sdk/fastify popularity was classified as not popular.
We found that @aegis-sdk/fastify 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.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.