Skip to content

Update main#2

Merged
00dav00 merged 1033 commits into00dav00:mainfrom
rails:main
Apr 17, 2021
Merged

Update main#2
00dav00 merged 1033 commits into00dav00:mainfrom
rails:main

Conversation

@00dav00
Copy link
Owner

@00dav00 00dav00 commented Apr 17, 2021

Summary

Other Information

jorgemanrubia and others added 30 commits April 1, 2021 15:02
Order is inverted when inlined, which can make things difficult to read.

#41659 (comment)

In this case it doesn't really matter and I think it's better for `Configurable`
to go first, so the change is inverting the previous order deliberately.

[skip ci]
Co-authored-by: Rafael Mendonça França <rafaelmfranca@gmail.com>
Co-authored-by: Mark Oleson <fusion2004@hey.com>
These can be configured as +ActiveRecord::Encryption.config+ keys if you want,
so you can just use your own ENV vars in a config file if you prefer not to use
credentials.
This way users can override them and call #super

#41659 (comment)
I don't think this belong to the library yet. It's more like an util class we used
for building some mass-encryption tasks in HEY.
Move the Action Text stuff to its own concern in `actiontext`.
The .encrypts declaration in `ActionText::Encryption` was making this test
fail. It was failing to load a MySQL error that was being raised when trying
to determine the column limit.
Co-authored-by: Connor Shea <connor.james.shea@gmail.com>
This adds a new class `Scheme` that encapsulates the encryption
properties for a given attribute. This adds a proper code representation
for a domain concept we keep referring to: encryption schemes.

It's in charge of processing the user-passed config properties when
declaring the attribute, as well as of validating those.

This removes the concern of processing properties from
`EncryptableRecord` and `EncryptableAttributeType`. It's also nice to
have a place to group attribute encryption options, versus passing
lists of hashes around.

This is in preparation to upcoming changes that will add new config
options and support for previous encryption schemes.
This implements several changes to encourage deterministic encryption to
remain unchanged. The main motivation is letting you define unique
indexes on deterministically-encrypted columns:

- By default, deterministic encryption will always use the oldest
encryption scheme to encrypt new data, when there are many.
- You can skip this default behavior and make it always use the current
encryption scheme with:

```ruby
deterministic: { fixed: false } # using this should be a rare need
```

- Deterministic encryption still supports previous encryption schemes
normally. So they will be used to add additional values to queries, for
example.
- You can't rotate deterministic encryption keys anymore. We can add
support for that in the future.

This makes for reasonable defaults:

- People using "deterministic: true" will get unique indexes working out
of the box.
- The system will encourage keeping deterministic encryption stable:
  - By always using oldest encryption schemes
  - By forbidding configuring multiple keys

But you can still opt-out of the default if you need to.
This enables to disable deterministic encryption by just not setting
deterministic_key.
…ogging

Provide context when logging unpermitted parameters
This examines all the association branches we are being asked to preload
and will delay loading an association if it's likely that we find a
similar association later and can batch them together.

For example, when loading

    Author.preload(:posts, favorite_authors: :posts).first

The preloader now knows to delay loading the top level posts so that it
can load both the top level :posts and the :posts from the favourite
authors associations together.

Co-authored-by: Dinah Shi <dinahshi@github.com>
rafaelfranca and others added 29 commits April 14, 2021 23:13
The return type was changed in the PR #41704 after addition of mode
option. The current documentation is misleading since
documentation puropose strict_loading! would return boolean whereas
it returns the current mode set.

I can across this issue while debugging issue: #41827 and thought
this should be brought to the attention.

PR fixes the issue and would always return boolean based on
strict_loading is enabled or disabled.

```
user.strict_loading! # => true
user.strict_loading!(false) # => false
user.strict_loading!(mode: :n_plus_one_only) # => true
```
docs: fix grammar and spelling [ci skip]
…loading

ActiveRecord#strict_loading! should return boolean instead of current mode set.
Add setting for enumerating column names in SELECT statements
If the test fails the config should be reset as well.
…ivar

Convert Template::Types.type_klass to instance ivar
Reference:

https://buildkite.com/rails/rails/builds/76506#f42a5ab3-1923-4a9f-b843-56c4098b6bef
https://buildkite.com/rails/rails/builds/76590#04721d73-9505-4c29-82bf-0a1be1f41649
https://buildkite.com/rails/rails/builds/76556#aa284ad0-0eab-48e9-a50b-60e3b5c7ccac

Apparently when loading different fixtures that reference the same
table, the files that are loaded last run a `DELETE FROM` statement
that removes previous data.

Reproduction command using `minitest_bisect`:

```
activerecord $ bin/test -a mysql2 --seed 22031 -n "/^(?:ActiveRecord::Encryption::EncryptableRecordTest#(?:test_when_downcase:_true_it_creates_content_downcased)|ActiveRecord::Encryption::EncryptableFixtureTest#(?:test_fixtures_get_encrypted_automatically))$/"
```
[ci skip]Updated abbreviation for single table inheritance.
Fix test `EncryptableFixtureTest` that fails intermittently
@00dav00 00dav00 merged commit 50a8603 into 00dav00:main Apr 17, 2021
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

Successfully merging this pull request may close these issues.