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.
This is a package that includes all AMQP handled messages by the CoSecurity infrastructure
Internal library for exchanging messages between services instantiated in the AWS environment.
The base used for the elaboration of the package was the PIKA library developed by the RabbitMQ team.
To use the library it is necessary to have Python3 installed on the machine and run the following command:
python3 -m pip install cosecurity-amqp-lib
AMQP_USER
user for connecting to RabbitMQAMQP_PASSWORD
password for connecting to RabbitMQ[SERVICE_NAME]
service name and respective service queue name, can be more than oneAMQP_SOCKET_TIMEOUT
socket connect timeout in secondsAMQP_HEARTBEAT
AMQP connection heartbeat timeout value for negotiation during connection tuning or callable which is invoked during connection tuningAMQP_HOST
host to connect to RabbitMQ, if localhost does not need to fill the portAMQP_BROKER_ID
amqp id inside awsAWS_REGION
region where amqp is allocated within awsConsumers are instances that monitor a specific queue, and if there is a change in the queue, they perform a certain action.
In this library a consumer can have more than one action/method, called primitive
. In addition, each action will still have its default input set.
Each method that must be an action must be registered so that it can be triggered if there is a change in the directed queue.
Below is an example of how to create a consumer class:
from typing import Any, Dict
from cosecurity_amqp_lib.consumer import Consumer
class ConsumerExample(Consumer):
def __init__(self) -> None:
super().__init__(
name='example'
)
self.register(self.primitive_one)
self.register(self.primitive_two)
self.start()
def primitive_one(self, content:Dict[str, Any]) -> None:
print(content['hello'])
def primitive_two(self, content:Dict[str, Any]) -> None:
print(content['message'])
Producers are responsible for producing and/or posting new messages in consumer queues.
In the internal library the producers are called stub
, I try their methods defined and typed based on what has already been defined as primitive
in their consumer.
Below is an example of how to create a stub
inside the library in the stub.py file:
class ExampleStub(Stub):
def __init__(self):
super().__init__(
destination='example'
)
def primitive_one(self) -> None:
self._send(
primitive='primitive_one',
content={
'hello': 'word'
}
)
def primitive_two(self, message:str) -> None:
self._send(
primitive='primitive_two',
content={
'message': message
}
)
Now, an example of how to use an already created stub
and publish it in the library in Pypi:
from cosecurity_amqp_lib.stub import ExampleStub
example_stub = ExampleStub()
example_stub.primitive_one()
example_stub.primitive_two(message='Hello world!')
In the creation of the consumers it is possible to pass some additional configurations for the creation of the queue, these configurations can be found on the official RabbitMQ website. Below is a representation of how to pass an additional argument:
class ConsumerExample(Consumer):
def __init__(self) -> None:
[...]
self.start(
arguments={
'x-queue-mode': 'lazy'
}
)
In the example/simple
folder we have a real case example of a stub
sending an string to a consumer.
FAQs
This is a package that includes all AMQP handled messages by the CoSecurity infrastructure
We found that cosecurity-amqp-lib 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
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.