-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Don't encrypt boolean settings (by default) #47179
Merged
Merged
64
−13
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We have tooling to disable encryption on settings even when the `MB_ENCRYPTION_SECRET_KEY` is set. Turn it on by default for all boolean settings, which don't need to be encrypted. I also optimized the code that decrypts settings on startup because I didn't want to delay startup if someone had set a bunch of boolean settings. With 20 set, the old version added about 200 ms to startup, about 10ms per boolean setting, whether or not it was encrypted or in the DB already. The optimized version selects all the never-encrypt values from the database at once (a bit silly, but we also just exclude raw `true` and `false` values so we don't bother checking them) and updates them if they're encrypted - this adds ~40ms to startup with 20 encrypted boolean settings (about 2ms per boolean setting) and ~5ms to startup on subsequent runs, when no encrypted values are in the DB. Also added a quick test for `migrate-encrypted-settings!`.
06e1d01
to
2c38fe5
Compare
noahmoss
reviewed
Aug 26, 2024
@@ -97,6 98,13 @@ | |||
:default "setting-default" | |||
:feature :test-feature) | |||
|
|||
(defsetting test-never-encrypted-setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could maybe also include a basic test that a :boolean
setting defaults to :never
?
noahmoss
approved these changes
Aug 26, 2024
escherize
approved these changes
Aug 26, 2024
github-automation-metabase
pushed a commit
that referenced
this pull request
Aug 26, 2024
* Don't encrypt boolean settings (by default) We have tooling to disable encryption on settings even when the `MB_ENCRYPTION_SECRET_KEY` is set. Turn it on by default for all boolean settings, which don't need to be encrypted. I also optimized the code that decrypts settings on startup because I didn't want to delay startup if someone had set a bunch of boolean settings. With 20 set, the old version added about 200 ms to startup, about 10ms per boolean setting, whether or not it was encrypted or in the DB already. The optimized version selects all the never-encrypt values from the database at once (a bit silly, but we also just exclude raw `true` and `false` values so we don't bother checking them) and updates them if they're encrypted - this adds ~40ms to startup with 20 encrypted boolean settings (about 2ms per boolean setting) and ~5ms to startup on subsequent runs, when no encrypted values are in the DB.
github-automation-metabase
added a commit
that referenced
this pull request
Aug 26, 2024
* Don't encrypt boolean settings (by default) We have tooling to disable encryption on settings even when the `MB_ENCRYPTION_SECRET_KEY` is set. Turn it on by default for all boolean settings, which don't need to be encrypted. I also optimized the code that decrypts settings on startup because I didn't want to delay startup if someone had set a bunch of boolean settings. With 20 set, the old version added about 200 ms to startup, about 10ms per boolean setting, whether or not it was encrypted or in the DB already. The optimized version selects all the never-encrypt values from the database at once (a bit silly, but we also just exclude raw `true` and `false` values so we don't bother checking them) and updates them if they're encrypted - this adds ~40ms to startup with 20 encrypted boolean settings (about 2ms per boolean setting) and ~5ms to startup on subsequent runs, when no encrypted values are in the DB. Co-authored-by: John Swanson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport
Automatically create PR on current release branch on merge
.Team/AdminWebapp
Admin and Webapp team
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have tooling to disable encryption on settings even when the
MB_ENCRYPTION_SECRET_KEY
is set. Turn it on by default for all boolean settings, which don't need to be encrypted.I also optimized the code that decrypts settings on startup because I didn't want to delay startup if someone had set a bunch of boolean settings. With 20 set, the old version added about 200 ms to startup, about 10ms per boolean setting, whether or not it was encrypted or in the DB already. The optimized version selects all the never-encrypt values from the database at once (a bit silly, but we also just exclude raw
true
andfalse
values so we don't bother checking them) and updates them if they're encrypted - this adds ~40ms to startup with 20 encrypted boolean settings (about 2ms per boolean setting) and ~5ms to startup on subsequent runs, when no encrypted values are in the DB.Fixes #47101