Enhance encryption configuration to enforce required keys for symmetric encryption#175
Conversation
WalkthroughRefactored encryption key validation logic across deployment templates to simplify symmetric provider conditions, remove redundant checks in secureVault branches, and conditionally emit encryption_key in secrets only when using the symmetric crypto provider. Changes follow a consistent pattern across all modified files. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@distributed/gateway/confs/deployment.toml`:
- Around line 284-304: The fallback fail message inside the symmetric-encryption
Helm template is misleading: update the fail text emitted by the conditional
that checks .Values.wso2.apim.configurations.encryption.key /
.Values.wso2.apim.configurations.existingSecret.* to explicitly state that
secureVault also requires providing wso2.apim.configurations.encryption.key (or
the existingSecret keys) because the same key is later used to populate
[secrets].encryption_key; locate the conditional block using the symbols
.Values.wso2.apim.configurations.encryption.key,
.Values.wso2.apim.configurations.existingSecret.secretName,
.Values.wso2.apim.configurations.existingSecret.encryptionKeyKey,
.Values.wso2.apim.secureVaultEnabled and change the fail message to mention that
secureVault alone is not sufficient and an encryption key must be supplied.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 49c83e1b-3ab9-436d-a996-558d0acd956c
📒 Files selected for processing (8)
all-in-one/confs/instance-1/deployment.tomlall-in-one/confs/instance-2/deployment.tomldistributed/control-plane/confs/instance-1/deployment.tomldistributed/control-plane/confs/instance-2/deployment.tomldistributed/gateway/confs/deployment.tomldistributed/key-manager/confs/deployment.tomldistributed/traffic-manager/confs/instance-1/deployment.tomldistributed/traffic-manager/confs/instance-2/deployment.toml
Purpose
This pull request updates the encryption configuration logic across multiple deployment configuration files to improve the handling of symmetric key encryption, especially when secure vault is enabled. The changes ensure that encryption keys are required and validated appropriately, and that secrets are only set when the symmetric key provider is used.
Key changes include:
Encryption Key Validation and Configuration Logic:
[encryption]section, so that checks for the symmetric key provider and secure vault are clearer and more robust. Now, the requirement for an encryption key is enforced only when theSymmetricKeyInternalCryptoProvideris selected, and the error messages are more precise. [1] [2] [3] [4] [5] [6] [7] [8]Secrets Section Updates:
[secrets]section to only include theencryption_keysecret when the symmetric key provider is in use, preventing unnecessary secret population for other providers. [1] [2] [3] [4] [5] [6] [7] [8]These improvements enhance security and reduce configuration errors related to encryption key management in all-in-one, distributed control plane, gateway, key manager, and traffic manager deployments.
Summary by CodeRabbit