Skip to content

Comments

Fix hardcoded region in cfn__resource_injection (Fixes #484)#497

Open
HoseinGhandi wants to merge 2 commits intoRhinoSecurityLabs:masterfrom
HoseinGhandi:fix-cfn-region-bug
Open

Fix hardcoded region in cfn__resource_injection (Fixes #484)#497
HoseinGhandi wants to merge 2 commits intoRhinoSecurityLabs:masterfrom
HoseinGhandi:fix-cfn-region-bug

Conversation

@HoseinGhandi
Copy link

Description

This PR resolves Issue #484 by removing the hardcoded us-east-1 region within the cfn__resource_injection module, ensuring the tool functions correctly across all AWS regions.

Changes Made

  • Removed the hardcoded 'us-east-1' string from the main function.
  • Refactored get_session_from_key_name and get_aws_key_by_name to handle regions dynamically.
  • Utilized **session_args to allow boto3.Session to intelligently default to the user's environment region or accept explicitly passed arguments.

Related Issue

Fixes #484

Thank you for reviewing! Let me know if any further modifications are needed.

Removed hardcoded us-east-1 region and updated get_session_from_key_name and get_aws_key_by_name functions. Session handling is now dynamic, allowing boto3 to default to the user's configured environment or explicitly passed regions.
@nobodynate
Copy link
Contributor

@HoseinGhandi thank you for this pull request.
Is there a good reason to completely remove pacu/modules/cfn__resource_injection/main.py and pacu/modules/iam__privesc_scan/main.py?

@HoseinGhandi
Copy link
Author

Hey @nobodynate, my bad! My Windows Antivirus falsely flagged those specific module files as malware and automatically deleted them from my local directory while I was working on the fix. I didn't notice the deletion got included in the commit! 😄
I've added an exclusion, restored the files, and updated the PR. Thanks for catching that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cfn__resource_injection_lambda-dev-update_template tries to use a function in us-east-1 even though I set it in a different region

2 participants