-
Notifications
You must be signed in to change notification settings - Fork 0
made the user_password section sensitive #490
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughBoth files have been updated to wrap the Changes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
modules/mongo_user/default/0.2/locals.tf(1 hunks)modules/mongo_user/default/0.3/locals.tf(1 hunks)
🔇 Additional comments (1)
modules/mongo_user/default/0.3/locals.tf (1)
11-11: Consistent security improvement across versions.The sensitive() wrapper is applied consistently in version 0.3, mirroring the change in 0.2. This ensures uniform security handling of passwords across module versions.
|
|
||
| user_name = lookup(local.user, "username", module.unique_name.name) | ||
| user_password = lookup(local.user, "password", module.user_password.result) | ||
| user_password = sensitive(lookup(local.user, "password", module.user_password.result)) |
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.
🧩 Analysis chain
Security improvement: password is now marked as sensitive.
The sensitive() wrapper correctly prevents the password from appearing in Terraform logs and plan outputs, which is a security best practice.
Verify that downstream code (resources, outputs, or other modules referencing local.user_password) properly handles the sensitive value wrapper. Please confirm:
- Are there any resources or outputs that use
local.user_passwordthat might break with the sensitive annotation? - Does the module that provides
module.user_password.resultalso return a sensitive value?
🏁 Script executed:
#!/bin/bash
# Description: Verify downstream usage of user_password in the mongo_user module
# Search for references to user_password in the module directory
echo "=== Searching for user_password references ==="
rg -n "user_password" modules/mongo_user/default/0.2/ --type tf
echo ""
echo "=== Checking for outputs that might expose the sensitive value ==="
rg -n "output.*user_password\|user_password.*output" modules/mongo_user/default/0.2/ --type tfLength of output: 557
---
🏁 Script executed:
```shell
#!/bin/bash
# Display full context of outputs.tf to understand output structure
echo "=== Full outputs.tf file ==="
cat modules/mongo_user/default/0.2/outputs.tf
echo ""
echo "=== Context around line 22 in main.tf ==="
sed -n '15,30p' modules/mongo_user/default/0.2/main.tf
Length of output: 699
Critical security issue: output "password" exposes the sensitive value.
The sensitive() wrapper on local.user_password does not propagate to outputs in Terraform. The output block at line 15 of outputs.tf must explicitly mark the password output as sensitive:
output "password" {
value = local.user_password
sensitive = true
}
Without this, the password will be exposed in terraform output commands and stored unmasked in state. The sensitive() wrapper on the local variable alone is insufficient for protecting output values.
The kubernetes_secret resource usage (main.tf line 22) is safe and properly stores the password as sensitive data.
🤖 Prompt for AI Agents
In modules/mongo_user/default/0.2/locals.tf around line 14 and outputs.tf at
line 15, the local.user_password is wrapped with sensitive() but the outputs.tf
password output is not marked sensitive; update the outputs.tf password output
block to set sensitive = true so Terraform will mask the value in outputs and
state views, i.e., explicitly add the sensitive = true attribute to the password
output and keep the current value reference to local.user_password.
Description
Related issues
Type of change
Checklist
developbranchTesting
Reviewer instructions
Summary by CodeRabbit