
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
nestjs-session-sniffer
Advanced tools
A powerful NestJS library that automatically intercepts HTTP requests, logs user activity to your primary database (via TypeORM), and syncs logs to Elasticsearch for advanced analytics.
A powerful NestJS library that automatically intercepts HTTP requests, logs user activity to your primary database (via TypeORM), and syncs logs to Elasticsearch for advanced analytics.
npm install nestjs-session-sniffer
Ensure you have the following peer dependencies installed in your host application:
npm install @nestjs/typeorm typeorm @nestjs/elasticsearch @nestjs/event-emitter nestjs-cls
This library relies on your application's existing database connection. You do not need to configure a separate database connection for this library.
You need to:
// src/app.module.ts
import { Module } from '@nestjs/common';
import { APP_INTERCEPTOR } from '@nestjs/core';
import { TypeOrmModule } from '@nestjs/typeorm';
import { EventEmitterModule } from '@nestjs/event-emitter';
import {
SessionSnifferModule,
ElasticConfigModule,
SessionSnifferService,
ActivityLog,
} from 'nestjs-session-sniffer';
@Module({
imports: [
// 1. Required: Event Emitter
EventEmitterModule.forRoot(),
// 2. Database Configuration
TypeOrmModule.forRoot({
type: 'mysql', // or postgres, mariadb, etc.
host: 'localhost',
port: 3306,
username: 'root',
password: 'password',
database: 'my_app_db',
// IMPORTANT: Register the library entity here
entities: [ActivityLog, /* ... your other entities */],
synchronize: true, // Set to false in production
}),
// 3. Elasticsearch Configuration (Optional but recommended)
ElasticConfigModule.forRoot({
elasticUrl: process.env.ELASTIC_NODE || 'http://localhost:9200',
}),
// 4. Import the Main Module
SessionSnifferModule,
],
providers: [
// 5. Register the Interceptor Globally
{
provide: APP_INTERCEPTOR,
useClass: SessionSnifferService,
},
],
})
export class AppModule {}
This library automatically pushes logs to an Elasticsearch index named activity-logs-YYYY-MM-DD.
The ElasticConfigModule.forRoot() method accepts a simple configuration object:
ElasticConfigModule.forRoot({
elasticUrl: 'http://localhost:9200', // URL of your Elasticsearch node
})
When a request is intercepted:
If Elasticsearch is down or unreachable:
Solution: Ensure you have imported the ActivityLog entity in your AppModule's TypeOrmModule.forRoot({ entities: [ActivityLog] }).
Solution: Ensure EventEmitterModule.forRoot() is imported in your AppModule.
FAQs
A powerful NestJS library that automatically intercepts HTTP requests, logs user activity to your primary database (via TypeORM), and syncs logs to Elasticsearch for advanced analytics.
The npm package nestjs-session-sniffer receives a total of 0 weekly downloads. As such, nestjs-session-sniffer popularity was classified as not popular.
We found that nestjs-session-sniffer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.