Skip to content

Commit f3ba830

Browse files
authored
Merge pull request rails#55044 from duffuniverse/fix-typos-in-active-record-encryption-guide
[ci skip] Fix a few typos in the Active Record Encryption guide
2 parents 1e906c1 + 09c5795 commit f3ba830

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

guides/source/active_record_encryption.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ There is an important concern about string column sizes: in modern databases the
8282

8383
In practice, this means:
8484

85-
* When encrypting short texts written in western alphabets (mostly ASCII characters), you should account for that 255 additional overhead when defining the column size.
86-
* When encrypting short texts written in non-western alphabets, such as Cyrillic, you should multiply the column size by 4. Notice that the storage overhead is 255 bytes at most.
85+
* When encrypting short texts written in Western alphabets (mostly ASCII characters), you should account for that 255 additional overhead when defining the column size.
86+
* When encrypting short texts written in non-Western alphabets, such as Cyrillic, you should multiply the column size by 4. Notice that the storage overhead is 255 bytes at most.
8787
* When encrypting long texts, you can ignore column size concerns.
8888

8989
Some examples:
@@ -147,7 +147,7 @@ To encrypt Action Text fixtures, you should place them in `fixtures/action_text/
147147

148148
`active_record.encryption` will serialize values using the underlying type before encrypting them, but, unless using a custom `message_serializer`, *they must be serializable as strings*. Structured types like `serialized` are supported out of the box.
149149

150-
If you need to support a custom type, the recommended way is using a [serialized attribute](https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html). The declaration of the serialized attribute should go **before** the encryption declaration:
150+
If you need to support a custom type, the recommended way is to use a [serialized attribute](https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html). The declaration of the serialized attribute should go **before** the encryption declaration:
151151

152152
```ruby
153153
# CORRECT
@@ -188,7 +188,7 @@ end
188188
To ease migrations of unencrypted data, the library includes the option `config.active_record.encryption.support_unencrypted_data`. When set to `true`:
189189

190190
* Trying to read encrypted attributes that are not encrypted will work normally, without raising any error.
191-
* Queries with deterministically-encrypted attributes will include the "clear text" version of them to support finding both encrypted and unencrypted content. You need to set `config.active_record.encryption.extend_queries = true` to enable this.
191+
* Queries with deterministically encrypted attributes will include the "clear text" version of them to support finding both encrypted and unencrypted content. You need to set `config.active_record.encryption.extend_queries = true` to enable this.
192192

193193
**This option is meant to be used during transition periods** while clear data and encrypted data must coexist. Both are set to `false` by default, which is the recommended goal for any application: errors will be raised when working with unencrypted data.
194194

@@ -208,7 +208,7 @@ You can configure previous encryption schemes:
208208
209209
#### Global Previous Encryption Schemes
210210
211-
You can add previous encryption schemes by adding them as list of properties using the `previous` config property in your `application.rb`:
211+
You can add previous encryption schemes by adding them as a list of properties using the `previous` config property in your `application.rb`:
212212
213213
```ruby
214214
config.active_record.encryption.previous = [ { key_provider: MyOldKeyProvider.new } ]
@@ -254,7 +254,7 @@ NOTE: If you want to ignore case, make sure to use `downcase:` or `ignore_case:`
254254

255255
#### Unique Indexes
256256

257-
To support unique indexes on deterministically-encrypted columns, you need to ensure their ciphertext doesn't ever change.
257+
To support unique indexes on deterministically encrypted columns, you need to ensure their ciphertext doesn't ever change.
258258
259259
To encourage this, deterministic attributes will always use the oldest available encryption scheme by default when multiple encryption schemes are configured. Otherwise, it's your job to ensure encryption properties don't change for these attributes, or the unique indexes won't work.
260260

@@ -266,7 +266,7 @@ end
266266

267267
### Filtering Params Named as Encrypted Columns
268268

269-
By default, encrypted columns are configured to be [automatically filtered in Rails logs](action_controller_overview.html#parameters-filtering). You can disable this behavior by adding the following to your `application.rb`:
269+
By default, encrypted columns are configured to be [automatically filtered in Rails logs](configuring.html#config-filter-parameters). You can disable this behavior by adding the following to your `application.rb`:
270270

271271
```ruby
272272
config.active_record.encryption.add_to_filter_parameters = false
@@ -336,7 +336,7 @@ config.active_record.encryption.compressor = ZstdCompressor
336336

337337
## Key Management
338338

339-
Key providers implement key management strategies. You can configure key providers globally, or on a per attribute basis.
339+
Key providers implement key management strategies. You can configure key providers globally or on a per-attribute basis.
340340

341341
### Built-in Key Providers
342342

@@ -464,7 +464,7 @@ article.decrypt # decrypt all the encryptable attributes
464464
article.ciphertext_for(:title)
465465
```
466466

467-
#### Check if Attribute is Encrypted or Not
467+
#### Check if the Attribute is Encrypted or Not
468468

469469
```ruby
470470
article.encrypted_attribute?(:title)
@@ -530,12 +530,12 @@ The digest algorithm used to derive keys. `OpenSSL::Digest::SHA256` by default.
530530

531531
#### `config.active_record.encryption.support_sha1_for_non_deterministic_encryption`
532532

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

536536
#### `config.active_record.encryption.compressor`
537537

538-
The compressor used to compress encrypted payloads. It should respond to `deflate` and `inflate`. Default is `Zlib`. You can find more information about compressors in the [Compression](#compression) section.
538+
The compressor used to compress encrypted payloads. It should respond to `deflate` and `inflate`. The default is `Zlib`. You can find more information about compressors in the [Compression](#compression) section.
539539

540540
### Encryption Contexts
541541

@@ -550,7 +550,7 @@ The main components of encryption contexts are:
550550
* `key_provider`: serves encryption and decryption keys.
551551
* `message_serializer`: serializes and deserializes encrypted payloads (`Message`).
552552

553-
NOTE: If you decide to build your own `message_serializer`, it's important to use safe mechanisms that can't deserialize arbitrary objects. A common supported scenario is encrypting existing unencrypted data. An attacker can leverage this to enter a tampered payload before encryption takes place and perform RCE attacks. This means custom serializers should avoid `Marshal`, `YAML.load` (use `YAML.safe_load` instead), or `JSON.load` (use `JSON.parse` instead).
553+
NOTE: If you decide to build your own `message_serializer`, it's important to use safe mechanisms that can't deserialize arbitrary objects. A commonly supported scenario is encrypting existing unencrypted data. An attacker can leverage this to enter a tampered payload before encryption takes place and perform RCE attacks. This means custom serializers should avoid `Marshal`, `YAML.load` (use `YAML.safe_load` instead), or `JSON.load` (use `JSON.parse` instead).
554554

555555
#### Global Encryption Context
556556

0 commit comments

Comments
 (0)