
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
A Django model fields collection that encrypt your data when save to and decrypt when get from database. It keeps data always encrypted in database.
A Django model fields collection that encrypt your data when save to and decrypt when get from database. It keeps data always encrypted in database. Base on AES, it supports query method like get()
and filter()
in Django.
Mirage can also migrate data from origin column to encrypted column in database with a good performance.
get()
, filter()
query methoddb_index
and unique
attributespip install django-mirage-field
from mirage import fields
class TestModel(models.Model):
age = fields.EncryptedIntegerField()
obj = TestModel.objects.get(age=18)
obj.id # 1
obj.age # 18
type(obj.age) # int
database=# select * from testmodel where id = 1;
id | age
---------------------+--------------------------
1 | -bYijegsEDrmS1s7ilnspA==
from mirage.crypto import Crypto
c = Crypto() # key is optional, default will use settings.SECRET_KEY
c.encrypt('some_address') # -bYijegsEDrmS1s7ilnspA==
c.decrypt('-bYijegsEDrmS1s7ilnspA==') # some_address
You can use the settings.SECRET_KEY
as default key, if you want custom another key for mirage, set the MIRAGE_SECRET_KEY
in settings.
Mirage will get the settings.MIRAGE_SECRET_KEY
first, if not set, mirage will get the settings.SECRET_KEY
.
MIRAGE_CIPHER_MODE
is optional, choices are below, If don't set, default is ECB
.
ECB
CBC
MIRAGE_CIPHER_IV
is optional, if you don't set, it will use a default: "1234567890abcdef", it's length must be 16.
Addmirage
toINSTALLED_APPS
add app_name
,model_name
,field_name
in migrations.RunPython
from mirage.tools import Migrator
migrations.RunPython(Migrator("app_name", "model_name", "field_name").encrypt, reverse_code=Migrator("app_name", 'model_name', 'field_name').decrypt),
Options:
encrypt
, decrypt
, encrypt_to
, decrypt_to
, copy_to
)encryt_to
, decrypt_to
, copy_to
method)Optional options:
Examples
./manage.py mirage --app=yourapp --model=testmodel --field=address --method=encrypt --offset=2000000 --total=3000000
./manage.py mirage --app=yourapp --model=testmodel --field=address --method=encrypt_to --tofield=encrypted_address
from mirage import exceptions
Migrate data: 6000,000 columns takes 40 minutes, Average 1 column/2.5ms
Only encrypt/decrypt: Average 1 value/ms
FAQs
A Django model fields collection that encrypt your data when save to and decrypt when get from database. It keeps data always encrypted in database.
We found that django-mirage-field 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.