-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong attributes are stored for encrypted attributes #1431
Comments
I think the root cause is roughly here. The type here is a (ruby) Post.type_for_attribute(:name).serialize('asdf')
"{\"p\":\"RLLLSA==\",\"h\":{\"iv\":\"H7c94XC/8rKT9jN/\",\"at\":\"QJmzn+d6IJ+4lnGRpOM3Ug==\"}}"
(ruby) Post.type_for_attribute(:name).serialize('asdf')
"{\"p\":\"ngsW0A==\",\"h\":{\"iv\":\"yeLWQvJucVR+LVcQ\",\"at\":\"yFddZTzXzefl+VzR1sCh+w==\"}}"
(ruby) Post.type_for_attribute(:name).serialize('asdf')
"{\"p\":\"M2O6tQ==\",\"h\":{\"iv\":\"TUz7TkOsgUN9XjoL\",\"at\":\"8zhIkMB3f0dHG2ea8qBWXw==\"}}" Assuming this is intentional (I think it is, but not certain), then Paper Trail should not re-run the serialization since it returns a new value. We could skip re-serializing using a mechanism similar to @jorgemanrubia sorry to tag you on a gem that you have nothing to do with, but I was hoping you could just confirm if it's intended that |
@ghiculescu yes, that's expected. When using the default "non deterministic" encryption, each time you encrypt a value it generates a random initialization vector, so the encrypted payload will be different, even if the cleartext is the same. |
This issue has been automatically marked as stale due to inactivity. |
Okay. I think this is a bug then. |
I can make a PR if that’s confirmed ^ |
This issue has been automatically marked as stale due to inactivity. |
If you have an encrypted attribute, and use
object_changes
, the changes stored don't match the attribute on the record.I would expect this test to pass:
But it fails:
paper_trail
gemThe text was updated successfully, but these errors were encountered: