debug: Display updated JSON in vault-backup.sh#164
debug: Display updated JSON in vault-backup.sh#164venkatamutyala wants to merge 1 commit intomainfrom
Conversation
Added echo command to display updated JSON before validation.
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label
|
||||||||||||||||||||||||
PR Code Suggestions ✨
Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Pull request overview
This PR adds debug output to display the updated JSON payload before it's sent for validation in the vault backup script. While this could be useful for troubleshooting, it introduces a critical security concern by unconditionally logging sensitive vault secrets and S3 presigned URLs.
Key Changes
- Added an echo command to output UPDATED_JSON with jq formatting before validation
- The output is unconditional and always executes, regardless of debug settings
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| UPDATED_JSON=$(echo $BASE_JSON | jq --arg path "secret/$FIRST_SECRET_NO_PREFIX" --argjson kv "$KEY_VALUES" '.path_values_map[$path] = $kv') | ||
|
|
||
| echo "$UPDATED_JSON" | jq . |
There was a problem hiding this comment.
This echo command outputs sensitive information including vault secret values (from KEY_VALUES) and S3 presigned URLs. This data will be exposed in logs and could pose a security risk. Consider either:
- Wrapping this in a conditional check like
if [ "$VAULT_BACKUP_ENABLE_DEBUG" == "TRUE" ](similar to line 67-69), or - Removing this debug output entirely if it's not needed for production use.
If debug output is required, ensure logs are properly secured and access-controlled.
| echo "$UPDATED_JSON" | jq . | |
| if [ "$VAULT_BACKUP_ENABLE_DEBUG" == "TRUE" ]; then | |
| echo "$UPDATED_JSON" | jq . | |
| fi |
|
|
||
| UPDATED_JSON=$(echo $BASE_JSON | jq --arg path "secret/$FIRST_SECRET_NO_PREFIX" --argjson kv "$KEY_VALUES" '.path_values_map[$path] = $kv') | ||
|
|
||
| echo "$UPDATED_JSON" | jq . |
There was a problem hiding this comment.
The debug output is inconsistent with the existing pattern in the script. Line 67-69 uses VAULT_BACKUP_ENABLE_DEBUG to conditionally enable debug output. This unconditional echo should follow the same pattern for consistency.
| echo "$UPDATED_JSON" | jq . | |
| if [ "$VAULT_BACKUP_ENABLE_DEBUG" == "TRUE" ]; then | |
| echo "$UPDATED_JSON" | jq . | |
| fi |
User description
Added echo command to display updated JSON before validation.
PR Type
Other
Description
Added debug echo command to display updated JSON
Formats output using jq for readability
Helps troubleshoot JSON structure before validation
Diagram Walkthrough
File Walkthrough
vault-backup.sh
Add debug echo for JSON output formattingvault-backup.sh
echo "$UPDATED_JSON" | jq .command after JSON update