Django encrypted model field that fetches the value from multiple sources
Project description
DJANGO-SECRETS-FIELDS
❯ Encrypted fields in Django
🔗 Table of Contents
- 📍 Overview
- 👾 Features
- 📁 Project Structure
- 🚀 Getting Started
- 📌 Project Roadmap
- 🔰 Contributing
- 🎗 License
- 🙌 Acknowledgments
📍 Overview
Django encrypted fields with support for multiple backends, currently supports symmetric encryption using Fernet and AWS Secrets Manager. Two fields types are currently supported, SecretTextField and SecretJSONField.
👾 Features
Symmetric Encryption: Encrypt fields using Fernet encryption.AWS Secrets Manager: Use AWS Secrets Manager as a backend for storing secrets.Multiple Backends: Use multiple backends for different fields.
🚀 Getting Started
☑️ Prerequisites
Before getting started with django-secrets-fields, ensure your runtime environment meets the following requirements:
- Programming Language: Python 3.10+
⚙️ Installation
Install django-secrets-fields:
pip install django-secrets-fields
To use backend that requires AWS install using:
pip install django-secrets-fields[aws]
🤖 Usage
settings.py
DJANGO_SECRETS_FIELDS = {
"default": {
"backend": "secrets_fields.backends.encrypted.EncryptedBackend",
"encryption_key": b"<fernet key>",
},
"aws": {
"backend": "secrets_fields.backends.secretsmanager.SecretsManagerBackend",
"prefix": "/path/",
},
}
# If you need to migrate from plaintext fields, set this value to True and run `manage.py migrate_encrypted` - this could take a long time depending on the number of models and instances.
DJANGO_SECRETS_FIELDS_MIGRATE = True
A Fernet key can be generated using the following command:
python manage.py generate_fernet_key
models.py
from django.db import models
from secrets_fields.fields import SecretJSONField, SecretTextField
class MyModel(models.Model):
secret_text = SecretTextField(backend="aws")
secret_json = SecretJSONField()
📌 Project Roadmap
-
Symmetric backend: Add symmetric encryption backend. -
Asymmetric backedn: Add asymmetric encryption backend. -
AWS Parameter Store: Add AWS Parameter Store backend.
🔰 Contributing
- 💬 Join the Discussions: Share your insights, provide feedback, or ask questions.
- 🐛 Report Issues: Submit bugs found or log feature requests for the
django-secrets-fieldsproject. - 💡 Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/ryan-shaw/django-secrets-fields
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
🎗 License
This project is protected under the MIT License. For more details, refer to the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_secrets_fields-1.0.5.tar.gz.
File metadata
- Download URL: django_secrets_fields-1.0.5.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c56b864387c806b00401e68657c0ba8c590888cbf496580ca21fe13b49521d9d
|
|
| MD5 |
4fde0825479f0aec0777eee8199752b2
|
|
| BLAKE2b-256 |
7df14896b00da4cba6e1731b6d5d5cc0bb7d088864e268c5ac7e099bd66c06c9
|
Provenance
The following attestation bundles were made for django_secrets_fields-1.0.5.tar.gz:
Publisher:
publish.yml on ryan-shaw/django-secrets-fields
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_secrets_fields-1.0.5.tar.gz -
Subject digest:
c56b864387c806b00401e68657c0ba8c590888cbf496580ca21fe13b49521d9d - Sigstore transparency entry: 169361918
- Sigstore integration time:
-
Permalink:
ryan-shaw/django-secrets-fields@71e70156da749597b9b04eb15277dd182f45ca83 -
Branch / Tag:
refs/tags/1.0.5 - Owner: https://github.com/ryan-shaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@71e70156da749597b9b04eb15277dd182f45ca83 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_secrets_fields-1.0.5-py3-none-any.whl.
File metadata
- Download URL: django_secrets_fields-1.0.5-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b80386d6184ce85de1349b14adce8515ad6eaa6182ad9d67f677c50e4eca7b76
|
|
| MD5 |
98af525535603bbc6036b6bb3ae0e9e5
|
|
| BLAKE2b-256 |
8c9beb539ab7edc0bd8b45ff11d2a11e58797b1dd50e45a0d12ee32c3e6576bc
|
Provenance
The following attestation bundles were made for django_secrets_fields-1.0.5-py3-none-any.whl:
Publisher:
publish.yml on ryan-shaw/django-secrets-fields
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_secrets_fields-1.0.5-py3-none-any.whl -
Subject digest:
b80386d6184ce85de1349b14adce8515ad6eaa6182ad9d67f677c50e4eca7b76 - Sigstore transparency entry: 169361919
- Sigstore integration time:
-
Permalink:
ryan-shaw/django-secrets-fields@71e70156da749597b9b04eb15277dd182f45ca83 -
Branch / Tag:
refs/tags/1.0.5 - Owner: https://github.com/ryan-shaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@71e70156da749597b9b04eb15277dd182f45ca83 -
Trigger Event:
release
-
Statement type: