Repository navigation
db: encrypt userdata - #14589
Draft
DaanHoogland wants to merge 2 commits into
Draft
db: encrypt userdata#14589DaanHoogland wants to merge 2 commits into
DaanHoogland wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14589 +/- ##
=========================================
Coverage 20.78% 20.78%
- Complexity 21931 21934 +3
=========================================
Files 6496 6496
Lines 591657 591673 +16
Branches 72592 72593 +1
=========================================
+ Hits 122966 122984 +18
+ Misses 455346 455342 -4
- Partials 13345 13347 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 25.89% |
| Branch coverage | 20.22% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
DaanHoogland
force-pushed
the
ghi14530-db-encrypt-userdata
branch
from
November 6, 2026 14:16
476dae2 to
4087dde
Compare
|
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




Description
Userdata was stored as plain base64 in
user_vm.user_data,user_data.user_dataandautoscale_vmprofiles.user_data. It often contains cloud-init credentials, which anyone with DB read access could decode. Other secrets in the DB are already encrypted with the DB encryption key. This PR does the same for userdata.@Encrypton theuser_datafield ofUserVmVO,UserDataVO,AutoScaleVmProfileVO, and onUserVmJoinVO, which reads the column throughuser_vm_view.UserDataDaoImpl.findByUserData, used for the duplicate check inregisterUserData, matched the content in SQL. Encryption is non-deterministic, so it now narrows the search by account and domain and compares the decrypted values.Upgrade42300to2400.performDataMigrationencrypts the existing rows in the three tables. The columns aremediumtext, which leaves room for encrypted values above the 1 MB userdata limit.When DB encryption is not enabled,
DBEncryptionUtilleaves values unchanged, so the behaviour is the same as before.Related: #14530, #14588
Types of changes
Feature/Enhancement Scale
How Has This Been Tested?
Unit tests:
UserDataDaoImplTest: the duplicate lookup matches on the decrypted valueDatabaseUpgradeCheckerTeststill passesTo do before merge: upgrade a 4.23 DB with existing VMs, registered userdata and autoscale profiles. Then check that
listVirtualMachines(details=all) andgetVirtualMachineUserDatareturn the original userdata, that config drive / VR metadata still serve it, and that registering duplicate userdata is still rejected.How did you try to break this feature and the system with this change?
Searched for SQL that reads or matches
user_datacontent. The only matches were the duplicate check (fixed here) and older upgrade steps, which run before this one. Readers in the management server go through the VOs, which decrypt the value.🤖 Generated with Claude Code