Skip to content
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

fix(ebs): improve snapshot encryption logic and typos #2836

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions prowler/providers/aws/services/ec2/ec2_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,18 @@ def __describe_snapshots__(self, regional_client):
describe_snapshots_paginator = regional_client.get_paginator(
"describe_snapshots"
)
encrypted = False
for page in describe_snapshots_paginator.paginate(OwnerIds=["self"]):
for snapshot in page["Snapshots"]:
arn = f"arn:{self.audited_partition}:ec2:{regional_client.region}:{self.audited_account}:snapshot/{snapshot['SnapshotId']}"
if not self.audit_resources or (
is_resource_filtered(arn, self.audit_resources)
):
if snapshot["Encrypted"]:
encrypted = True
self.snapshots.append(
Snapshot(
id=snapshot["SnapshotId"],
arn=arn,
region=regional_client.region,
encrypted=encrypted,
encrypted=snapshot.get("Encrypted", False),
tags=snapshot.get("Tags"),
)
)
Expand All @@ -199,7 +196,7 @@ def __describe_snapshots__(self, regional_client):
)

def __get_snapshot_public__(self):
logger.info("EC2 - Gettting snapshots encryption...")
logger.info("EC2 - Getting snapshot volume attribute permissions...")
for snapshot in self.snapshots:
try:
regional_client = self.regional_clients[snapshot.region]
Expand Down Expand Up @@ -279,7 +276,7 @@ def __describe_sg_network_interfaces__(self, regional_client):
)

def __get_instance_user_data__(self):
logger.info("EC2 - Gettting instance user data...")
logger.info("EC2 - Getting instance user data...")
for instance in self.instances:
try:
regional_client = self.regional_clients[instance.region]
Expand Down