Skip to content

Fix anonymizers based on NumericFieldAnonymizer#9

Merged
xkubov merged 1 commit intoskip-pay:masterfrom
sp-tm:fix_numeric_field_anonymizers
Feb 27, 2026
Merged

Fix anonymizers based on NumericFieldAnonymizer#9
xkubov merged 1 commit intoskip-pay:masterfrom
sp-tm:fix_numeric_field_anonymizers

Conversation

@sp-tm
Copy link
Copy Markdown

@sp-tm sp-tm commented Feb 24, 2026

This fixes an issue that gdpr.anonymizers.base.NumericFieldAnonymizer.get_numeric_encryption_key might return a zero because the modulo operation used might produce a zero remainder. Most of the children of NumericFieldAnonymizer take this into account but some didn't and would pass that zero to gdpr.anonymizers.local.cs.CzechAccountNumber.brute_force_next resulting in no operation and therefore silently skipping the anonymization.

The following anonymizers were affected:

  • CzechIBANSmartFieldAnonymizer
  • CzechAccountNumberFieldAnonymizer
  • ExperimentalGISPointFieldAnonymizer (no tests added because this anonymizer seems kind of experimental and existing tests are being skipped)

WARNING: This change causes an incompatibility due to which previously anonymized data cannot be correctly deanonymized. This only affects setups that use reversive anonymization for those fields. As such, the next version should be a major one and declare this incompatibility.

@sp-tm sp-tm force-pushed the fix_numeric_field_anonymizers branch 2 times, most recently from 3b074d8 to 352d9d6 Compare February 24, 2026 07:54
get_numeric_encryption_key method could return zero which would cause
some of the anonymizers to not perform any anonymization whatsover.
@sp-tm sp-tm force-pushed the fix_numeric_field_anonymizers branch from 352d9d6 to f4033e0 Compare February 24, 2026 08:02
python-dateutil==2.7.5
django-extensions
freezegun==0.3.12
freezegun
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version doesn't work in Python >= 3.13.

skip-django-germanium==2.4.0
skip-django-germanium==2.6.0
django-auditlog
setuptools
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for Python >= 3.12.

'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: 3 :: Only',
'Intended Audience :: Developers',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a duplicate definition.

'Intended Audience :: Developers',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
python_requires='>=3.10',
Copy link
Copy Markdown
Author

@sp-tm sp-tm Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm setting 3.10 as the minimum version because:

  1. Previous versions have already reached EOL.
  2. The code was already incompatible with versions < 3.10, e.g. because of declarations like Type[Model] | None while not importing from __future__.

@xkubov xkubov merged commit 66446f8 into skip-pay:master Feb 27, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants