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.
Cerami is a python library that hopefully provides some sanity to boto3's DynamoDB client. Its intended use is as a library to help define table data through the creation of models and create sane, readable, and reproducable DynamoDB requests.
Please read the Full Documentation
_
.. _Full Documentation: https://cerami.readthedocs.io/en/latest/
.. code-block::
pip install cerami
.. code-block:: python
# create the db singleton
import boto3
from cerami import Cerami
dynamodb = boto3.client('dynamodb')
db = Cerami(dynamodb)
.. code-block:: python
# create classes that inherit from the singleton
from cerami.datatype import String, Set, Datetime
from cerami.decorators import primary_key
@primary_key('name', 'artist')
class Album(db.Model):
__tablename__ = "Albums"
name = String()
artist = String()
songs = Set(String())
released_date = Datetime()
# Some Query Examples
Album.scan \
.filter(Album.released_date.begins_with("1996")) \
.execute()
Album.query \
.key(Album.name == "The Black Album") \
.execute()
Album.get \
.key(Album.name == "Reasonable Doubt") \
.key(Album.artist == "Jay-Z") \
.execute()
You can run DynamoDB locally!
You need to install the aws2 cli and have dynamo db running locally. Dynamodb requires java to run locally as well so good luck if you dont have it. Try these steps first and see how it goes.
Download DynamoDB Locally
1. `Download DynamoDB Locally`_
2. Unzip/Untar the content
3. Move to somewhere you wont lose it.
.. _Download DynamoDB Locally: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html
Download the AWS2 CLI
~~~~~~~~~~~~~~~~~~~~~
1. `Download the AWS2 CLI`_
2. Follow the install instructions
.. _Download the AWS2 CLI`: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
Configure the AWS2 CLI
~~~~~~~~~~~~~~~~~~~~~~
In order to run DynamoDB locally, you need to configure your aws as such:
.. code-block::
aws2 configure
.. code-block::
# These are the actual values to use with the local dynamodb instance
AWS Access Key ID: "fakeMyKeyId"
AWS Secret Access Key: "fakeSecretAccessKey"
us-west-1
Starting DynamoDB Locally
.. code-block::
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Creating a DynamoDB Table
.. code-block:: python
import boto3
dynamodb = boto3.client('dynamodb', endpoint_url="http://localhost:8000")
dynamodb.create_table(
TableName='Albums',
KeySchema=[
{
'AttributeName': 'name',
'KeyType': 'HASH' #Partition key
},
{
'AttributeName': 'artist',
'KeyType': 'Range', # Sort key
},
],
AttributeDefinitions=[
{
'AttributeName': 'name',
'AttributeType': 'S'
},
{
'AttributeName': 'artist',
'AttributeType': 'S'
},
],
ProvisionedThroughput={
'ReadCapacityUnits': 10,
'WriteCapacityUnits': 10
}
)
Using Cerami
~~~~~~~~~~~~
.. code-block:: python
# Create the db singleton
import boto3
from cerami import Cerami
dynamodb = boto3.client('dynamodb', endpoint_url="http://localhost:8000")
db = Cerami(dynamodb)
.. code-block:: python
# create classes that inherit from the singleton
from cerami.datatype import String, Set, Datetime
from cerami.decorators import primary_key
@primary_key('name', 'artist')
class Album(db.Model):
__tablename__ = "Albums"
name = String()
artist = String()
songs = Set(String())
released_date = Datetime()
FAQs
A Dynamodb ORM
We found that cerami 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.