Skip to content

Fix plaintext lookup and transform bypasses on encrypted fields - #7

Merged
script3r merged 1 commit into
mainfrom
codex/fix-encrypted-lookups
Sep 5, 2026
Merged

Fix plaintext lookup and transform bypasses on encrypted fields#7
script3r merged 1 commit into
mainfrom
codex/fix-encrypted-lookups

Conversation

@script3r

@script3r script3r commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Encrypted JSON key lookups, date transforms, and lookups registered after import bypassed the ciphertext restrictions. For example, filter(payload__has_key="secret") generated JSON SQL against encrypted bytes. These operations now raise FieldError when the query is constructed.

Use an explicit lookup allowlist and two concrete equality classes instead of generating lookup subclasses from Django's registry at import time. Deterministic equality and SQL null handling retain their existing behavior. Custom registered lookups are intentionally rejected too.

Validation: 12 new regression cases failed before the fix; all 90 library tests and 6 example integration tests pass on Python 3.14 / Django 6.0. Ruff lint/format and Pyright pass. Regression coverage includes inherited transforms, projected JSON keys, late lookup registration, and raw SQL NULL storage.

Stack position: 1 of 6; base is main. Land this before the remaining PRs in the stack.

Landing order: #7#8#9#10#11#12.

Full review and landing notes. Use merge commits to preserve stack ancestry; squash/rebase merges require rebasing the remaining stack before landing it.

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.

1 participant