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

Add additional queries to 'Other Compliance Checks' #678

Merged
merged 48 commits into from
Jul 6, 2023

Conversation

khushboo9024
Copy link
Contributor

@khushboo9024 khushboo9024 commented Jul 4, 2023

Checklist

  1. eks_cluster_endpoint_public_access_restircted
  2. guardduty_centrally_configured
  3. iam_role_cross_account_readonlyaccess_policy
  4. iam_securityaudit_role
  5. rds_db_instance_connections_encryption_enabled
  6. vpc_in_more_than_one_region
  7. vpc_subnet_multi_az_enabled
  8. workspaces_workspace_volume_encryption_enabled
  9. autoscaling_ec2_launch_configuration_no_sensitive_data
  10. lambda_function_restrict_public_url
  11. lambda_function_variables_no_sensitive_data
  12. iam_policy_custom_no_permissive_role_assumption
  13. vpc_subnet_public_and_private

case
when (select count(*) from vpc_region_list) > 1 then 'VPCs exist in ' || (select count(*) from vpc_region_list) || ' regions.'
else 'VPC does not exist in more than one region.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khushboo9024 if there are NO subnets exists, then we can reason

  ALARM: test_peering no subnet exists. ..................................................................................... us-east-2 123456781234

@rajlearner17 rajlearner17 marked this pull request as ready for review July 5, 2023 08:57
Copy link
Contributor

@rajlearner17 rajlearner17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rajlearner17 rajlearner17 changed the title Add Extra check queries Add additional queries to 'Other Compliance Checks' Jul 5, 2023
Copy link
Contributor

@madhushreeray30 madhushreeray30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khushboo9024 can you please have a look at the comments, thanks!

from
aws_iam_policy as p
left join bad_policies as b on p.arn = b.arn
where
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
where
where

}

control "vpc_subnet_public_and_private" {
title = "VPCs both public and private subnets should be configured"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title = "VPCs both public and private subnets should be configured"
title = "VPCs should have both public and private subnets configured"

from
aws_account as a
left join vpc_count_in_account as v on v.account_id = a.account_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
left join vpc_count_in_account as v on v.account_id = a.account_id
left join vpc_count_in_account as v on v.account_id = a.account_id;

@@ -572,6 +572,36 @@ control "iam_policy_no_full_access_to_kms" {
})
}

control "iam_role_cross_account_readonlyaccess_policy" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
control "iam_role_cross_account_readonlyaccess_policy" {
control "iam_role_cross_account_read_only_access_policy" {

control "iam_role_cross_account_readonlyaccess_policy" {
title = "IAM roles should not have read only access for external AWS accounts"
description = "Ensure IAM Roles do not have ReadOnlyAccess access for external AWS account. The AWS-managed ReadOnlyAccess policy carries a high risk of potential data leakage, posing a significant threat to customer security and privacy."
query = query.iam_role_cross_account_readonlyaccess_policy
Copy link
Contributor

@madhushreeray30 madhushreeray30 Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
query = query.iam_role_cross_account_readonlyaccess_policy
query = query.iam_role_cross_account_read_only_access_policy

EOQ
}

query "iam_securityaudit_role" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
query "iam_securityaudit_role" {
query "iam_security_audit_role" {


query "iam_securityaudit_role" {
sql = <<-EOQ
with securityaudit_role_count as(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with securityaudit_role_count as(
with security_audit_role_count as(

end as reason
${local.common_dimensions_global_sql}
from
securityaudit_role_count;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
securityaudit_role_count;
security_audit_role_count;

})
}

control "iam_securityaudit_role" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
control "iam_securityaudit_role" {
control "iam_security_audit_role" {

control "iam_securityaudit_role" {
title = "IAM Security Audit role should be created to conduct security audits"
description = "Ensure IAM Security Audit role is created. By creating an IAM role with a security audit policy, a distinct segregation of responsibilities is established between the security team and other teams within the organization."
query = query.iam_securityaudit_role
Copy link
Contributor

@madhushreeray30 madhushreeray30 Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
query = query.iam_securityaudit_role
query = query.iam_security_audit_role

Copy link
Contributor

@madhushreeray30 madhushreeray30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@misraved misraved merged commit f50b505 into release/v0.74 Jul 6, 2023
@misraved misraved deleted the extra-check-queries branch July 6, 2023 12:42
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.

None yet

5 participants