Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@dapr/dapr
Advanced tools
The official Dapr Node.js SDK that allows interfacing with the Dapr sidecar for easy application building.
The Dapr JS SDK will allow you to interface with the Dapr process that abstracts several commonly used functionalities such as Service-to-Service invocation, State Management, PubSub, and more.
Looking at the illustration above, we can see there will always always be another process (the Dapr Sidecar) running that your application will interface with. This process can either be started manually (e.g. through Dapr CLI) or injected as a container (e.g. through Kubernetes Sidecar injection in your pod).
For your application to interface with this, 2 components should be taken into account:
As a simple example, consider the use case: "Creating a PubSub where we can publish a message on a Topic and also receive messages back from this topic". Normally for this use case we would have to look at the Broker that we want to utilize and implement their specificities. While as with Dapr we can use a simple SDK and configure the "component" that we want to interface with.
🤩 This also means that if we want to switch from one broker to another (e.g. Azure Service Bus to RabbitMQ) we just have to change the component implementation!
component.yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: my-pubsub-component
namespace: default
spec:
type: pubsub.rabbitmq
version: v1
metadata:
- name: host
value: "amqp://localhost:5672"
example.ts
import { DaprClient, DaprServer } from "@dapr/dapr";
const daprHost = "127.0.0.1"; // Dapr Sidecar Host
const daprPort = "50000"; // Dapr Sidecar Port
const serverHost = "127.0.0.1"; // App Host of this Example Server
const serverPort = "50001"; // App Port of this Example Server
// Create a Server (will subscribe) and Client (will publish)
const server = new DaprServer(serverHost, serverPort, daprHost, daprPort);
const client = new DaprClient(daprHost, daprPort);
// Initialize the server to subscribe (listen)
await server.pubsub.subscribe("my-pubsub-component", "my-topic", async (data: any) => console.log(`Received: ${JSON.stringify(data)}`));
await server.start();
// Send a message
await client.pubsub.publish("my-pubsub-component", "my-topic", { hello: "world" });
To start this we of course have to start the Dapr process with it. With the command below we can utilize the CLI to quickly test this:
dapr run --app-id example-http-pubsub --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./components npm run start
Which will result in the message:
Received: {"hello":"world"}
FAQs
The official Dapr (https://dapr.io) SDK for Node.js
The npm package @dapr/dapr receives a total of 6,879 weekly downloads. As such, @dapr/dapr popularity was classified as popular.
We found that @dapr/dapr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.