You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
api: add userdata to sensitive data queries and obfuscate - #14588
Async APIs that take userdata stored it in async_job.job_cmd_info as plain base64, along with the other request parameters. Cloud-init often contains passwords, so anyone with DB read access could recover them. The same parameters were also published unmasked on the event bus as cmdInfo of async job events.
This PR reuses the existing AsyncJobDataHelper encryption by setting requestHasSensitiveInfo = true on the async APIs that accept userdata:
deployVirtualMachine, deployVnfAppliance, createVMFromBackup (user and admin versions)
This also encrypts the deploy password parameter, which is stored in the same column.
Supporting changes:
AsyncJobDaoImpl.countPendingJobs used SQL LIKE on job_cmd_info, which cannot match encrypted rows. It now filters pending jobs on the decrypted value. Without this, the pending backup job check would stop working for createVMFromBackup.
ApiServer: userdata is added to the existing sensitiveFields set. That set is now applied through a single isSensitiveField() helper to both the request trace log and the cmdInfo of published async job events.
Note: event consumers now see ****** for every field the set matches, and a password value is fully masked instead of showing its first character.
Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change which adds functionality)
Bug fix (non-breaking change which fixes an issue)
Enhancement (improves an existing feature and functionality)
Cleanup (Code refactoring and cleanup, that may add test cases)
Build/CI
Test (unit or integration test code)
Bug Severity
BLOCKER
Critical
Major
Minor
Trivial
How Has This Been Tested?
Unit tests:
AsyncJobDataHelperTest: job_cmd_info is encrypted for each of the userdata commands
AsyncJobDaoImplTest: countPendingJobs matches on the decrypted command info
ApiServerTest: userdata is masked in the async job event description
How did you try to break this feature and the system with this change?
Checked every consumer of job_cmd_info. Most read it through AsyncJobVO.getCmdInfo(), which decrypts it. The only SQL match on the column was countPendingJobs, which is fixed here. Rows written before the upgrade are plain JSON, and decryptIfNeeded returns those unchanged.
❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.34%. Comparing base (d02adcd) to head (c820081).
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
This branch has not been deployed
No deployments
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
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.
Async APIs that take
userdatastored it inasync_job.job_cmd_infoas plain base64, along with the other request parameters. Cloud-init often contains passwords, so anyone with DB read access could recover them. The same parameters were also published unmasked on the event bus ascmdInfoof async job events.This PR reuses the existing
AsyncJobDataHelperencryption by settingrequestHasSensitiveInfo = trueon the async APIs that accept userdata:deployVirtualMachine,deployVnfAppliance,createVMFromBackup(user and admin versions)createAutoScaleVmProfile,updateAutoScaleVmProfileThis also encrypts the deploy
passwordparameter, which is stored in the same column.Supporting changes:
AsyncJobDaoImpl.countPendingJobsused SQLLIKEonjob_cmd_info, which cannot match encrypted rows. It now filters pending jobs on the decrypted value. Without this, the pending backup job check would stop working forcreateVMFromBackup.ApiServer:userdatais added to the existingsensitiveFieldsset. That set is now applied through a singleisSensitiveField()helper to both the request trace log and thecmdInfoof published async job events.Note: event consumers now see
******for every field the set matches, and apasswordvalue is fully masked instead of showing its first character.Fixes: #14530
Types of changes
Bug Severity
How Has This Been Tested?
Unit tests:
AsyncJobDataHelperTest:job_cmd_infois encrypted for each of the userdata commandsAsyncJobDaoImplTest:countPendingJobsmatches on the decrypted command infoApiServerTest: userdata is masked in the async job event descriptionHow did you try to break this feature and the system with this change?
Checked every consumer of
job_cmd_info. Most read it throughAsyncJobVO.getCmdInfo(), which decrypts it. The only SQL match on the column wascountPendingJobs, which is fixed here. Rows written before the upgrade are plain JSON, anddecryptIfNeededreturns those unchanged.🤖 Generated with Claude Code