
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
nestjs-grpc-reflection-sb
Advanced tools
A pluggable gRPC Reflection Server for the NestJS framework
A pluggable gRPC Reflection Server for the excellent NestJS framework.
Adding this module to your existing NestJS-based gRPC microservice will allow clients such as postman to dynamically load your API definitions from your running application rather than needing to load each proto file manually.
To get started, first install the package:
$ npm install nestjs-grpc-reflection
Then simply register the GrpcReflectionModule
from the root module of your application - it takes in the same GrpcOptions
that are used to create your microservice. The gRPC Reflection Server module runs within your application's existing gRPC server just as any other controller in your microservice, so loading the module will add the appropriate routes to your application.
import { GrpcReflectionModule } from 'nestjs-grpc-reflection';
...
@Module({
imports: [GrpcReflectionModule.register(grpcClientOptions)],
...
})
export class AppModule {}
Finally, NestJS needs to know where the reflection proto files are so that it can serialize/deserialize its message traffic. For convenience, this can be automatically added to your GrpcOptions
using the addReflectionToGrpcConfig
function like so:
import { addReflectionToGrpcConfig } from 'nestjs-grpc-reflection';
...
export const grpcClientOptions: GrpcOptions = addReflectionToGrpcConfig({
transport: Transport.GRPC,
options: {
package: 'sample',
protoPath: join(__dirname, 'sample/proto/sample.proto'),
},
});
Alternatively, these paths can be added manually by appending the REFLECTION_PACKAGE
and REFLECTION_PROTO
constants to the package
and protoPath
lists respectively.
:warning: If you are using @grpc/proto-loader's
keepCase
option you may experience some issues with the server reflection API. This module assumes that the microservice server is running withkeepCase
off (the NestJS default) and will attempt to convert back to the original case if it's on but this may not be perfect in all cases.
This repository contains a simple example gRPC service as well as the gRPC reflection module library, so new features can be tested against that service.
$ npm install
This repo uses ts-proto for type generation. If any of the the reflection API proto files are changed, we'll need to regenerate the types to reflect that change. This relies on the protoc
compiler, so if that's not installed already you'll need to do so first - instructions can be found on their site here.
$ npm run generate # regenerate reflection types, requires 'protoc' to be installed
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
FAQs
A pluggable gRPC Reflection Server for the NestJS framework
The npm package nestjs-grpc-reflection-sb receives a total of 1 weekly downloads. As such, nestjs-grpc-reflection-sb popularity was classified as not popular.
We found that nestjs-grpc-reflection-sb 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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.