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

Updates AWS managed policies #878

Merged
merged 2 commits into from
Jan 5, 2025
Merged

Updates AWS managed policies #878

merged 2 commits into from
Jan 5, 2025

Conversation

udondan
Copy link
Owner

@udondan udondan commented Aug 6, 2024

Updates AWS managed policies

Copy link

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent updates to various AWS IAM policies involve the addition and modification of permissions across multiple services. Notable changes include the introduction of new permission statements for the AWS Backup Full Access policy, modifications to the AWS Backup Service Role Policy, and the creation of new policies aimed at managing compromised keys. The updates also enhance permissions for AWS services like Lambda, IVS, and others, refining access controls to improve security and operational capabilities.

Changes

Files Change Summary
docs/source/_static/managed-policies/AWSBackupFullAccess.json Added new permission statement for storagegateway:ListVolumes and modified existing permissions to separate listing capabilities from other actions.
docs/source/_static/managed-policies/AWSBackupServiceRolePolicyForBackup.json Updated permissions related to RDS, including renaming and modifying actions for automated backups, and added new permissions for cluster backups.
docs/source/_static/managed-policies/AWSCompromisedKeyQuarantineV2.json Expanded the list of denied actions significantly, adding multiple actions across various services.
docs/source/_static/managed-policies/AWSCompromisedKeyQuarantineV3.json New policy added to deny a wide array of actions across multiple AWS services to enhance security.
docs/source/_static/managed-policies/AWSConfigServiceRolePolicy.json Added multiple permissions for various AWS services, significantly broadening operational capabilities.
docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json Added new statements defining permissions for AWS Data Exchange, including job and S3 actions.
docs/source/_static/managed-policies/AWSDataExchangeServiceRolePolicyForLicenseManagement.json New policy added for AWS License Manager actions related to organizations.
docs/source/_static/managed-policies/AWSDirectoryServiceDataFullAccess.json New policy added to grant extensive permissions for managing AWS Directory Service data.
docs/source/_static/managed-policies/AWSServiceRoleForAmazonEKSNodegroup.json Updated permissions related to Auto Scaling management by adding new actions.
docs/source/_static/managed-policies/AWSSupportPlansFullAccess.json Added action "supportplans:ListSupportPlanModifiers" to enhance support plan management capabilities.
docs/source/_static/managed-policies/AWSSupportPlansReadOnlyAccess.json Added action "supportplans:ListSupportPlanModifiers" to expand read-only access to support plans.
docs/source/_static/managed-policies/AWSSupportServiceRolePolicy.json Expanded permissions across various AWS services, enhancing the functionality of the associated AWS service role.
docs/source/_static/managed-policies/AWS_ConfigRole.json Added numerous permissions across various AWS services, significantly expanding its functionality.
docs/source/_static/managed-policies/AmazonConnectServiceLinkedRolePolicy.json Enhanced permissions for managing customer profiles and wisdom services in Amazon Connect.
docs/source/_static/managed-policies/AmazonConnectSynchronizationServiceRolePolicy.json Added new permissions for managing hours of operation overrides in Amazon Connect.
docs/source/_static/managed-policies/AmazonSNSFullAccess.json Introduced a new statement for SMS access and modified action formats for SNS permissions.
docs/source/_static/managed-policies/AmazonSNSReadOnlyAccess.json Added new actions related to SNS and SMS voice services, enhancing read-only access capabilities.
docs/source/_static/managed-policies/AmazonSageMakerCanvasDataPrepFullAccess.json Updated resource permissions for EMR serverless roles, allowing broader access.
docs/source/_static/managed-policies/AmazonSageMakerCanvasFullAccess.json Similar updates to resource permissions for EMR serverless roles, enhancing access control.
docs/source/_static/managed-policies/AmazonSageMakerHyperPodServiceRolePolicy.json New policy added for EKS and CloudWatch logs permissions related to SageMaker HyperPod service.
docs/source/_static/managed-policies/AmazonVerifiedPermissionsFullAccess.json New policy added for Verified Permissions service, allowing comprehensive access for policy management.
docs/source/_static/managed-policies/AmazonVerifiedPermissionsReadOnlyAccess.json New policy added for read-only access to Verified Permissions service, focusing on listing and retrieving policy-related information.

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@udondan udondan force-pushed the update-aws-managed-policies branch 4 times, most recently from e5dd68b to ecc2f69 Compare August 13, 2024 01:32
@udondan udondan force-pushed the update-aws-managed-policies branch 3 times, most recently from 1f93f67 to 55588a4 Compare August 16, 2024 01:34
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (4)
docs/source/_static/managed-policies/AwsGlueSessionUserRestrictedNotebookPolicy.json (1)

24-37: Conditions for Tagging Correctly Implemented in Notebook Policy, Inconsistencies Found Elsewhere

The conditions for tagging in AwsGlueSessionUserRestrictedNotebookPolicy.json are correctly implemented using "aws:PrincipalTag/owner". However, other policy files such as AwsGlueSessionUserRestrictedPolicy.json and AwsGlueSessionUserRestrictedServiceRole.json use "${aws:userid}" instead, which may not align with the intended policy structure.

  • Ensure consistent use of "aws:PrincipalTag/owner" across all policies if that's the intended condition.
  • Review and update other policy files for consistency if required.
Analysis chain

Ensure conditions for tagging are correctly implemented.

The new "AllowGlueTaggingAction" statement allows tagging resources with strict conditions based on the owner tag. This change enhances security by ensuring only authorized users can tag resources. Verify that the conditions are correctly implemented and that the necessary tags are applied to all relevant resources and principals.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the conditions for tagging are correctly implemented.

# Test: Search for the usage of `AllowGlueTaggingAction`. Expect: Correct implementation of conditions.
rg --type json $'AllowGlueTaggingAction'

Length of output: 529


Script:

#!/bin/bash
# Extract and display the condition sections for "AllowGlueTaggingAction" across relevant policy files
rg --type json -A 10 '"Sid": "AllowGlueTaggingAction"' docs/source/_static/managed-policies/

Length of output: 5125

docs/source/_static/managed-policies/AwsGlueSessionUserRestrictedNotebookServiceRole.json (1)

43-56: Inconsistent Tagging Conditions in "AllowGlueTaggingAction"

The conditions for "AllowGlueTaggingAction" vary across different policy files. Ensure consistent implementation of conditions using ${aws:PrincipalTag/owner} if that is the intended approach:

  • AwsGlueSessionUserRestrictedServiceRole.json and AwsGlueSessionUserRestrictedPolicy.json use ${aws:userid}.
  • AwsGlueSessionUserRestrictedNotebookServiceRole.json and AwsGlueSessionUserRestrictedNotebookPolicy.json use ${aws:PrincipalTag/owner}.

Verify and standardize the conditions to align with the intended security model.

Analysis chain

Verify tagging conditions in "AllowGlueTaggingAction".

The new "AllowGlueTaggingAction" statement introduces tagging permissions with conditions based on the owner tag. This ensures that only authorized users can tag resources. Verify that the conditions are correctly implemented and enforced across all relevant resources and principals.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify tagging conditions in "AllowGlueTaggingAction".

# Test: Search for the usage of `AllowGlueTaggingAction`. Expect: Correct implementation of conditions.
rg --type json $'AllowGlueTaggingAction'

Length of output: 529


Script:

#!/bin/bash
# Description: Extract and review the conditions associated with "AllowGlueTaggingAction" in relevant JSON files.

# Extract the relevant sections from each JSON file where "AllowGlueTaggingAction" is defined.
for file in $(rg --files-with-matches --type json "AllowGlueTaggingAction"); do
  echo "File: $file"
  rg -A 10 '"Sid": "AllowGlueTaggingAction"' "$file"
  echo "-------------------------"
done

Length of output: 3223

docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json (2)

Restrict KMS Permissions to Necessary Resources

The AWSDataExchangeProviderFullAccess.json policy file contains multiple instances of broad permissions with "Resource": "". Specifically, the "KMSActions" SID allows key management operations on all KMS keys. To enhance security, consider scoping these permissions to specific resources rather than using "". This will help prevent unauthorized access to KMS keys.

  • File: docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json
  • Lines with broad permissions: Multiple instances of "Resource": "*"
Analysis chain

Line range hint 124-131:
Review KMSActions SID.

The permissions under "KMSActions" allow for key management operations. Ensure that these permissions are limited to necessary resources to prevent unauthorized key access.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the scope of KMS permissions.

# Test: Search for kms permissions usage. Expect: Limited to necessary resources.
rg --type json $'kms:DescribeKey'

Length of output: 8338


Script:

#!/bin/bash
# Description: Check for broad resource permissions in AWSDataExchangeProviderFullAccess.json.

# Search for instances of "Resource": "*" in the specified policy file.
rg --type json '"Resource": "*"' docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json

Length of output: 419


Review the scope of APIGatewayActions SID in AWSDataExchangeProviderFullAccess.json

The "APIGatewayActions" SID currently allows the "apigateway:GET" action on all resources ("Resource": "*"). This broad permission could lead to unintended exposure. Consider scoping this permission to specific resources to enhance security.

  • File: docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json, Lines: 153-159
Analysis chain

Line range hint 156-161:
Review APIGatewayActions SID.

The "APIGatewayActions" SID allows GET requests on API Gateway. Ensure that this permission is scoped correctly to prevent unintentional exposure.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the scope of API Gateway permissions.

# Test: Search for apigateway permissions usage. Expect: Scoped correctly to prevent exposure.
rg --type json $'apigateway:GET'

Length of output: 3461


Script:

#!/bin/bash
# Extract the full context of the "apigateway:GET" permission in AWSDataExchangeProviderFullAccess.json
rg -A 5 -B 5 '"apigateway:GET"' docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json

Length of output: 267

@udondan udondan force-pushed the update-aws-managed-policies branch 4 times, most recently from 0894070 to 23c7398 Compare August 20, 2024 01:34
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
docs/source/_static/managed-policies/AmazonECS_FullAccess.json (1)

Security Concern: Unrestricted Role Passing in TasksPassRolePolicy

The TasksPassRolePolicy allows the iam:PassRole action on all resources ("Resource": ["*"]). This can pose a security risk as it enables passing any role to ECS tasks. It is recommended to restrict this policy to specific roles necessary for the tasks to enhance security.

  • File: docs/source/_static/managed-policies/AmazonECS_FullAccess.json
  • Lines: 153-159
Analysis chain

Line range hint 156-164: Verify restriction and security of role passing.

The TasksPassRolePolicy allows passing roles to ECS tasks. Ensure that this is restricted to necessary roles only to maintain security.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the restriction and security of role passing in `TasksPassRolePolicy`.

# Test: Check for any unintended role passing permissions.
rg --type json '"TasksPassRolePolicy"'

Length of output: 139


Script:

#!/bin/bash
# Description: Extract detailed information about the conditions and resources in `TasksPassRolePolicy`.

# Extract the full policy statement for `TasksPassRolePolicy` to verify conditions and resources.
rg --type json -A 5 '"Sid": "TasksPassRolePolicy"' docs/source/_static/managed-policies/AmazonECS_FullAccess.json

Length of output: 249

@udondan udondan force-pushed the update-aws-managed-policies branch 6 times, most recently from 0690482 to c42a503 Compare August 28, 2024 01:34
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Comment on lines +76 to +89
"Sid": "PermissionsToManagePCSLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:DeleteLaunchTemplate",
"ec2:DeleteLaunchTemplateVersions",
"ec2:CreateLaunchTemplateVersion"
],
"Resource": "arn:aws:ec2:*:*:launch-template/*",
"Condition": {
"Null": {
"aws:ResourceTag/AWSPCSManaged": "false"
}
}
},
Copy link

Choose a reason for hiding this comment

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

Refine condition to ensure explicit tag value.

The condition should ensure that the AWSPCSManaged tag is explicitly set to true to avoid unintended actions.

- "Null": {
-   "aws:ResourceTag/AWSPCSManaged": "false"
- }
+ "StringEquals": {
+   "aws:ResourceTag/AWSPCSManaged": "true"
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"Sid": "PermissionsToManagePCSLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:DeleteLaunchTemplate",
"ec2:DeleteLaunchTemplateVersions",
"ec2:CreateLaunchTemplateVersion"
],
"Resource": "arn:aws:ec2:*:*:launch-template/*",
"Condition": {
"Null": {
"aws:ResourceTag/AWSPCSManaged": "false"
}
}
},
"Sid": "PermissionsToManagePCSLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:DeleteLaunchTemplate",
"ec2:DeleteLaunchTemplateVersions",
"ec2:CreateLaunchTemplateVersion"
],
"Resource": "arn:aws:ec2:*:*:launch-template/*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/AWSPCSManaged": "true"
}
}

Comment on lines +5 to +15
"Sid": "PermissionsToCreatePCSNetworkInterfaces",
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface"
],
"Resource": "arn:aws:ec2:*:*:network-interface/*",
"Condition": {
"Null": {
"aws:RequestTag/AWSPCSManaged": "false"
}
}
Copy link

Choose a reason for hiding this comment

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

Refine condition to ensure explicit tag value.

The condition should ensure that the AWSPCSManaged tag is explicitly set to true to avoid unintended actions.

- "Null": {
-   "aws:RequestTag/AWSPCSManaged": "false"
- }
+ "StringEquals": {
+   "aws:RequestTag/AWSPCSManaged": "true"
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"Sid": "PermissionsToCreatePCSNetworkInterfaces",
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface"
],
"Resource": "arn:aws:ec2:*:*:network-interface/*",
"Condition": {
"Null": {
"aws:RequestTag/AWSPCSManaged": "false"
}
}
"Sid": "PermissionsToCreatePCSNetworkInterfaces",
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface"
],
"Resource": "arn:aws:ec2:*:*:network-interface/*",
"Condition": {
"StringEquals": {
"aws:RequestTag/AWSPCSManaged": "true"
}
}

Comment on lines +145 to +159
"Sid": "PermissionsToProvisionClusterInstances",
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:CreateFleet"
],
"Resource": [
"arn:aws:ec2:*:*:instance/*"
],
"Condition": {
"Null": {
"aws:RequestTag/AWSPCSManaged": "false"
}
}
},
Copy link

Choose a reason for hiding this comment

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

Refine condition to ensure explicit tag value.

The condition should ensure that the AWSPCSManaged tag is explicitly set to true to avoid unintended actions.

- "Null": {
-   "aws:RequestTag/AWSPCSManaged": "false"
- }
+ "StringEquals": {
+   "aws:RequestTag/AWSPCSManaged": "true"
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"Sid": "PermissionsToProvisionClusterInstances",
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:CreateFleet"
],
"Resource": [
"arn:aws:ec2:*:*:instance/*"
],
"Condition": {
"Null": {
"aws:RequestTag/AWSPCSManaged": "false"
}
}
},
"Sid": "PermissionsToProvisionClusterInstances",
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:CreateFleet"
],
"Resource": [
"arn:aws:ec2:*:*:instance/*"
],
"Condition": {
"StringEquals": {
"aws:RequestTag/AWSPCSManaged": "true"
}
}

Comment on lines +63 to +73
"Sid": "PermissionsToCreatePCSLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplate"
],
"Resource": "arn:aws:ec2:*:*:launch-template/*",
"Condition": {
"Null": {
"aws:RequestTag/AWSPCSManaged": "false"
}
}
Copy link

Choose a reason for hiding this comment

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

Refine condition to ensure explicit tag value.

The condition should ensure that the AWSPCSManaged tag is explicitly set to true to avoid unintended actions.

- "Null": {
-   "aws:RequestTag/AWSPCSManaged": "false"
- }
+ "StringEquals": {
+   "aws:RequestTag/AWSPCSManaged": "true"
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"Sid": "PermissionsToCreatePCSLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplate"
],
"Resource": "arn:aws:ec2:*:*:launch-template/*",
"Condition": {
"Null": {
"aws:RequestTag/AWSPCSManaged": "false"
}
}
"Sid": "PermissionsToCreatePCSLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplate"
],
"Resource": "arn:aws:ec2:*:*:launch-template/*",
"Condition": {
"StringEquals": {
"aws:RequestTag/AWSPCSManaged": "true"
}
}

Comment on lines +29 to +41
"Sid": "PermissionsToManagePCSNetworkInterfaces",
"Effect": "Allow",
"Action": [
"ec2:DeleteNetworkInterface",
"ec2:CreateNetworkInterfacePermission"
],
"Resource": "arn:aws:ec2:*:*:network-interface/*",
"Condition": {
"Null": {
"aws:ResourceTag/AWSPCSManaged": "false"
}
}
},
Copy link

Choose a reason for hiding this comment

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

Refine condition to ensure explicit tag value.

The condition should ensure that the AWSPCSManaged tag is explicitly set to true to avoid unintended actions.

- "Null": {
-   "aws:ResourceTag/AWSPCSManaged": "false"
- }
+ "StringEquals": {
+   "aws:ResourceTag/AWSPCSManaged": "true"
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"Sid": "PermissionsToManagePCSNetworkInterfaces",
"Effect": "Allow",
"Action": [
"ec2:DeleteNetworkInterface",
"ec2:CreateNetworkInterfacePermission"
],
"Resource": "arn:aws:ec2:*:*:network-interface/*",
"Condition": {
"Null": {
"aws:ResourceTag/AWSPCSManaged": "false"
}
}
},
"Sid": "PermissionsToManagePCSNetworkInterfaces",
"Effect": "Allow",
"Action": [
"ec2:DeleteNetworkInterface",
"ec2:CreateNetworkInterfacePermission"
],
"Resource": "arn:aws:ec2:*:*:network-interface/*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/AWSPCSManaged": "true"
}
}
},

Comment on lines +91 to +102
"Sid": "PermissionsToTerminatePCSManagedInstances",
"Effect": "Allow",
"Action": [
"ec2:TerminateInstances"
],
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"Null": {
"aws:ResourceTag/AWSPCSManaged": "false"
}
}
},
Copy link

Choose a reason for hiding this comment

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

Refine condition to ensure explicit tag value.

The condition should ensure that the AWSPCSManaged tag is explicitly set to true to avoid unintended actions.

- "Null": {
-   "aws:ResourceTag/AWSPCSManaged": "false"
- }
+ "StringEquals": {
+   "aws:ResourceTag/AWSPCSManaged": "true"
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"Sid": "PermissionsToTerminatePCSManagedInstances",
"Effect": "Allow",
"Action": [
"ec2:TerminateInstances"
],
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"Null": {
"aws:ResourceTag/AWSPCSManaged": "false"
}
}
},
"Sid": "PermissionsToTerminatePCSManagedInstances",
"Effect": "Allow",
"Action": [
"ec2:TerminateInstances"
],
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/AWSPCSManaged": "true"
}
}
},

@udondan udondan force-pushed the update-aws-managed-policies branch 3 times, most recently from a427e98 to 0734cc4 Compare August 31, 2024 01:35
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment on lines +1223 to +1298
/** Denies access to certain actions, applied by AWS in the event that an IAM user's credentials have been compromised or exposed publicly. The policy aims to limit the potential damage that may be caused by fraud-related activity leading to unauthorized charges, while not impacting the existing resources. Do NOT remove this policy. Instead, please follow the instructions specified in the support case created for you regarding this event. */
public static AWSCompromisedKeyQuarantineV3 = 'AWSCompromisedKeyQuarantineV3';
Copy link

Choose a reason for hiding this comment

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

Security Concern: AWSCompromisedKeyQuarantineV3

The addition of the AWSCompromisedKeyQuarantineV3 policy is correctly implemented. However, the static analysis tool flagged this line as containing a potential security issue related to a generic API key. This is likely a false positive since the policy is designed to deny access to certain actions when an IAM user's credentials are compromised, which is a security feature.

It's important to verify that no sensitive keys or credentials are hardcoded in this policy or elsewhere in the codebase.

Please ensure that no sensitive information or credentials are exposed in the policy definitions or elsewhere. If this is a false positive, you may disregard the security warning from the static analysis tool.

Tools
Gitleaks

1224-1224: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

@udondan udondan force-pushed the update-aws-managed-policies branch 2 times, most recently from 2aa1aa3 to 4459e7c Compare September 3, 2024 01:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
docs/source/_static/managed-policies/AWSDataExchangeProviderFullAccess.json (2)

Line range hint 94-102: Avoid using broad permissions for S3 read actions.

The new statement with SID "S3ReadActions" allows read actions like s3:ListAllMyBuckets on any S3 resource ("Resource": "*"), which seems too permissive. Consider scoping down the Resource to specific buckets or using conditions to restrict the permissions for better security.


Line range hint 156-161: Avoid using broad permissions for API Gateway actions.

The new statement with SID "APIGatewayActions" allows the apigateway:GET action on any resource ("Resource": "*"), which seems too permissive. Consider scoping down the Resource to specific API Gateway resources or using conditions to restrict the permissions for better security.

@udondan udondan force-pushed the update-aws-managed-policies branch from 4459e7c to 432e443 Compare September 4, 2024 01:32
@udondan udondan force-pushed the update-aws-managed-policies branch 4 times, most recently from 3d59c4b to c776da3 Compare December 11, 2024 01:33
@udondan udondan force-pushed the update-aws-managed-policies branch 7 times, most recently from 72bfad7 to c08e617 Compare December 19, 2024 01:33
@udondan udondan force-pushed the update-aws-managed-policies branch 3 times, most recently from 54bae2e to fe0eb5f Compare December 27, 2024 01:32
@udondan udondan force-pushed the update-aws-managed-policies branch 6 times, most recently from 64faca9 to bf5a13a Compare January 4, 2025 01:32
@udondan udondan force-pushed the update-aws-managed-policies branch from bf5a13a to 1c142f5 Compare January 5, 2025 01:33
@udondan udondan force-pushed the update-aws-managed-policies branch from 1c142f5 to 166f47c Compare January 5, 2025 09:41
@udondan udondan merged commit d92b498 into main Jan 5, 2025
9 checks passed
@udondan udondan deleted the update-aws-managed-policies branch January 5, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant