Skip to content
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

Validation Does Not Work with Multiple Encryption Scheme #51553

Open
aveedibya opened this issue Apr 11, 2024 · 0 comments
Open

Validation Does Not Work with Multiple Encryption Scheme #51553

aveedibya opened this issue Apr 11, 2024 · 0 comments

Comments

@aveedibya
Copy link
Contributor

Steps to reproduce

Uniqueness validation with multiple encryption scheme does not work. The uniqueness validation is skipped if the field is set up with current deterministic encryption scheme and previously non-deterministic encryption scheme. Example model class shown below:

  class UserSensitiveTable < ApplicationRecord
   
      ...
      
      validates :sensitive_field, uniqueness: true
      encrypts :sensitive_field, deterministic: true, previous: { deterministic: false }
    
      ...
  
  end

Expected behavior

Records with a duplicate sensitive field should not be created.

Actual behavior

Multiple records can be created for the sensitive_field even though the uniqueness validation is added for this field.

System configuration

Rails 7.0.8.1
Ruby 3.1.2

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

No branches or pull requests

1 participant