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

Advise upgraders to set active_record.encryption.hash_digest_class #49587

Merged
merged 1 commit into from Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion guides/source/active_record_encryption.md
Expand Up @@ -495,7 +495,7 @@ The digest algorithm used to derive keys. `OpenSSL::Digest::SHA1` by default.
#### `config.active_record.encryption.support_sha1_for_non_deterministic_encryption`

Supports decrypting data encrypted non-deterministically with a digest class SHA1. Default is false, which
means it will only support the digest algorithm configured in `config.active_record.encryption.hash_digest_class`.
means it will only support the digest algorithm configured in `config.active_record.encryption.hash_digest_class`.

### Encryption Contexts

Expand Down
21 changes: 21 additions & 0 deletions guides/source/upgrading_ruby_on_rails.md
Expand Up @@ -315,6 +315,27 @@ puts Rails.logger.broadcasts #=> [MyLogger]

[assert_match]: https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-assert_match


### Active Record encryption algorithm changes

Active Record Encryption now uses SHA-256 as its hash digest algorithm. If you have data encrypted with previous Rails
versions, there are two scenarios to consider:

1. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too:

```ruby
config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1
```

1. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default
in 7.0), then you need to configure SHA-256 for Active Record Encryption:

```ruby
config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256
```


Upgrading from Rails 6.1 to Rails 7.0
-------------------------------------

Expand Down