feat: add encrypted casts for model fields and entities#10357
Open
memleakd wants to merge 3 commits into
Open
Conversation
- Add encrypted DataCaster support for Model fields and Entity properties. - Store encrypted values as Base64-encoded ciphertext using the Encryption service. - Document storage, validation, query, serialization, and key rotation caveats. - Add focused tests for encryption, decryption, nullable values, previous keys, and invalid payloads. Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
michalsn
approved these changes
Jun 30, 2026
paulbalandan
approved these changes
Jul 1, 2026
patel-vansh
approved these changes
Jul 1, 2026
patel-vansh
left a comment
Contributor
There was a problem hiding this comment.
Nice Addition. Thanks!
datamweb
reviewed
Jul 1, 2026
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an
encryptedcast type for Model Field Casting and Entity Property Casting.It uses the existing Encryption service to encrypt string values before storage and decrypt them when they are read back:
The encrypted value is stored as Base64-encoded ciphertext, so it can be safely saved in string/text database columns even when the encryption handler returns binary data.
The implementation is intentionally limited to string values, with nullable values supported through
?encrypted. The docs cover the important caveats around column size, querying encrypted values, passwords, serialization, and key rotation.Tests cover the cast itself, nullable values, invalid payloads, failed decryption, previous keys, DataConverter usage, and Entity raw/plain value behavior.
Checklist: