From e09d4ea7ff2b7ee47cdbcaeb65d1ff7ab5ee9e97 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 7 Mar 2026 16:32:44 -0500 Subject: [PATCH 1/7] remove non-tested django versions from the list of tested versions in the readme --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1e00730..94c22cf 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ for obj in MyModel.objects.all(): #### Available Fields -Currently build in and unit-tested fields. They have the same APIs as their non-encrypted counterparts. +Currently built-in and unit-tested fields include the following. +They have the same APIs as their non-encrypted counterparts. - `EncryptedCharField` - `EncryptedTextField` @@ -71,12 +72,12 @@ Currently build in and unit-tested fields. They have the same APIs as their non- ### Compatible Django Version | Compatible Django Version | Specifically tested | Python Version Required | -| ------------------------- | ------------------- | ----------------------- | -| `3.2` | :heavy_check_mark: | 3.8+ | -| `4.0` | :heavy_check_mark: | 3.8+ | -| `4.1` | :heavy_check_mark: | 3.8+ | +| ------------------------- |---------------------| ----------------------- | +| `3.2` | | 3.8+ | +| `4.0` | | 3.8+ | +| `4.1` | | 3.8+ | | `4.2` | :heavy_check_mark: | 3.8+ | -| `5.0` | :heavy_check_mark: | 3.10+ | +| `5.0` | | 3.10+ | | `5.1` | :heavy_check_mark: | 3.10+ | | `5.2` | :heavy_check_mark: | 3.10+ | | `6.0` | :heavy_check_mark: | 3.12+ | From f005bc86f459bcf90fa34dbc96d78ed00d3e436c Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 7 Mar 2026 16:37:48 -0500 Subject: [PATCH 2/7] add snippet on generating SECRET_KEYs --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 94c22cf..4d3e37a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,15 @@ SALT_KEY = [ ] ``` +To generate a new `SECRET_KEY`, you can use Django's `get_random_secret_key` function. + +```python +from django.core.management.utils import get_random_secret_key + +new_secret_key = get_random_secret_key() +print(new_secret_key) +``` + #### Rotating SECRET_KEY When you would want to rotate your `SECRET_KEY`, set the new value and put your old secret key value to `SECRET_KEY_FALLBACKS` list. That way the existing encrypted fields will still work, but when you re-save the field or create new record, it will be encrypted with the new secret key. (supported in Django >=4.1) From dacc011faea3f2b06a283020cbc040c2027ba151 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 7 Mar 2026 16:48:28 -0500 Subject: [PATCH 3/7] add contributing readme --- CONTRIBUTING.md | 34 ++++++++++++++++++++++++++++++++++ README.md | 5 +++++ 2 files changed, 39 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..09968ec --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +[![Jazzband](https://jazzband.co/static/img/jazzband.svg)](https://jazzband.co/) + +This is a [Jazzband](https://jazzband.co/) project. +By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines). + +## Contributing to Django Fernet Encrypted Fields + +We welcome contributions from the community to improve and maintain Django Fernet Encrypted Fields. +Please follow these guidelines to ensure your contributions are accepted: + +1. **Fork the Repository**: Start by forking the repository to a personal/organization GitHub account. +2. **Clone the Repository**: Clone the forked repository to your local machine. +3. **Set Up the Environment**: Set up a virtual environment and install the necessary + dependencies for development and testing. + ```shell + $ python -m venv .venv + $ source .venv/bin/activate + $ pip install -r requirements.txt + ``` +4. **Install the pre-commit hooks**: We use [pre-commit](https://pre-commit.com/) to ensure code quality. + Install the pre-commit hooks by running: + ```shell + $ pre-commit install + ``` +5. **Create a Branch**: Create a new branch for the feature or bug fix. +6. **Make Changes**: Make the changes and ensure they are well-documented. +7. **Run Tests**: Ensure all tests pass before submitting a pull request. + ```shell + $ pip install coverage pytest + $ coverage3 run --source='./encrypted_fields' manage.py test + ``` +8. **Submit Pull Request**: Submit a pull request with a clear title, description of the changes, + motivations, and any relevant issue numbers. + diff --git a/README.md b/README.md index 4d3e37a..9747183 100644 --- a/README.md +++ b/README.md @@ -90,3 +90,8 @@ They have the same APIs as their non-encrypted counterparts. | `5.1` | :heavy_check_mark: | 3.10+ | | `5.2` | :heavy_check_mark: | 3.10+ | | `6.0` | :heavy_check_mark: | 3.12+ | + + +### Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project. \ No newline at end of file From 504df2835b9520015dde4a1e368d86f8312aff63 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:56:46 +0000 Subject: [PATCH 4/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CONTRIBUTING.md | 41 ++++++++++++++++++++--------------------- README.md | 5 ++--- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09968ec..e2c9c3a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,34 +1,33 @@ [![Jazzband](https://jazzband.co/static/img/jazzband.svg)](https://jazzband.co/) -This is a [Jazzband](https://jazzband.co/) project. +This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines). ## Contributing to Django Fernet Encrypted Fields -We welcome contributions from the community to improve and maintain Django Fernet Encrypted Fields. +We welcome contributions from the community to improve and maintain Django Fernet Encrypted Fields. Please follow these guidelines to ensure your contributions are accepted: 1. **Fork the Repository**: Start by forking the repository to a personal/organization GitHub account. 2. **Clone the Repository**: Clone the forked repository to your local machine. -3. **Set Up the Environment**: Set up a virtual environment and install the necessary - dependencies for development and testing. - ```shell - $ python -m venv .venv - $ source .venv/bin/activate - $ pip install -r requirements.txt - ``` -4. **Install the pre-commit hooks**: We use [pre-commit](https://pre-commit.com/) to ensure code quality. - Install the pre-commit hooks by running: - ```shell - $ pre-commit install - ``` +3. **Set Up the Environment**: Set up a virtual environment and install the necessary + dependencies for development and testing. + ```shell + $ python -m venv .venv + $ source .venv/bin/activate + $ pip install -r requirements.txt + ``` +4. **Install the pre-commit hooks**: We use [pre-commit](https://pre-commit.com/) to ensure code quality. + Install the pre-commit hooks by running: + ```shell + $ pre-commit install + ``` 5. **Create a Branch**: Create a new branch for the feature or bug fix. 6. **Make Changes**: Make the changes and ensure they are well-documented. 7. **Run Tests**: Ensure all tests pass before submitting a pull request. - ```shell - $ pip install coverage pytest - $ coverage3 run --source='./encrypted_fields' manage.py test - ``` -8. **Submit Pull Request**: Submit a pull request with a clear title, description of the changes, - motivations, and any relevant issue numbers. - + ```shell + $ pip install coverage pytest + $ coverage3 run --source='./encrypted_fields' manage.py test + ``` +8. **Submit Pull Request**: Submit a pull request with a clear title, description of the changes, + motivations, and any relevant issue numbers. diff --git a/README.md b/README.md index 9747183..ff1f2f0 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ They have the same APIs as their non-encrypted counterparts. ### Compatible Django Version | Compatible Django Version | Specifically tested | Python Version Required | -| ------------------------- |---------------------| ----------------------- | +| ------------------------- | ------------------- | ----------------------- | | `3.2` | | 3.8+ | | `4.0` | | 3.8+ | | `4.1` | | 3.8+ | @@ -91,7 +91,6 @@ They have the same APIs as their non-encrypted counterparts. | `5.2` | :heavy_check_mark: | 3.10+ | | `6.0` | :heavy_check_mark: | 3.12+ | - ### Contributing -See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project. \ No newline at end of file +See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project. From d20b79cfc06f8e7f1c6be8f2c2645e8a7d7a8025 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 7 Mar 2026 17:01:40 -0500 Subject: [PATCH 5/7] add file filter for github actions lint-and-test workflow --- .github/workflows/lint-and-test.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 5d9966b..b91ab63 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -1,6 +1,16 @@ name: Lint & Test -on: [push, pull_request] +on: + pull_request: + paths: + - '.github/workflows/*' + - 'encrypted_fields/**/*' + - 'package_test/**/*' + - 'manage.py' + - 'requirements.txt' + - 'setup.py' + - 'pyproject.toml' + push: permissions: contents: read From 8b5c0dec55c0e6f4cbfadaabbf37c35201306711 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 7 Mar 2026 17:11:10 -0500 Subject: [PATCH 6/7] add path filters for the lint and test github actions workflow --- .github/workflows/lint-and-test.yml | 14 +++++++------- .gitignore | 12 ++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index b91ab63..b1bd5fb 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -3,13 +3,13 @@ name: Lint & Test on: pull_request: paths: - - '.github/workflows/*' - - 'encrypted_fields/**/*' - - 'package_test/**/*' - - 'manage.py' - - 'requirements.txt' - - 'setup.py' - - 'pyproject.toml' + - ".github/workflows/*" + - "encrypted_fields/**/*" + - "package_test/**/*" + - "manage.py" + - "requirements.txt" + - "setup.py" + - "pyproject.toml" push: permissions: diff --git a/.gitignore b/.gitignore index f0f01b9..1935a2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ +# Python +.Python +.eggs/ +lib64/ +sdist/ +var/ +__pycache__/ +*$py.class +*.so *.egg-info/ *.pyc build/ @@ -7,3 +16,6 @@ dist/ .ruff_cache .venv .venv_django_* + +# Node +node_modules/ From e054016c905768db5a9a0f21909e2ba7e2ef21ee Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 07:32:10 -0400 Subject: [PATCH 7/7] use path-ignore instead of path for file filters --- .github/workflows/lint-and-test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index b1bd5fb..c7f156e 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -2,15 +2,15 @@ name: Lint & Test on: pull_request: - paths: - - ".github/workflows/*" - - "encrypted_fields/**/*" - - "package_test/**/*" - - "manage.py" - - "requirements.txt" - - "setup.py" - - "pyproject.toml" + paths-ignore: + - "LICENCE.txt" + - "**/*.md" + - ".pre-commit-config.yaml" push: + paths-ignore: + - "LICENCE.txt" + - "**/*.md" + - ".pre-commit-config.yaml" permissions: contents: read