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 #1164

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Updates AWS managed policies #1164

merged 1 commit into from
Feb 26, 2025

Conversation

udondan
Copy link
Owner

@udondan udondan commented Feb 26, 2025

Updates AWS managed policies

Summary by CodeRabbit

  • New Features

    • Expanded access permissions to support additional network operations.
    • Introduced new managed policies enhancing role-based security and resource management for AWS services.
  • Style

    • Improved documentation formatting for enhanced consistency.

Copy link

coderabbitai bot commented Feb 26, 2025

Walkthrough

This pull request updates and adds several AWS managed policy JSON files. The AmazonFSxConsoleReadOnlyAccess policy is modified to include an extra permission, "ec2:DescribeNetworkInterfaces". Additionally, three new policy files are introduced for SageMaker Studio Bedrock roles—covering Function Execution, Knowledge Base Custom Resource, and Knowledge Base Service Role—with detailed permission sets for AWS Secrets Manager, KMS, OpenSearch, and S3. A minor formatting update is also applied to the policy index file.

Changes

File(s) Summary
docs/.../AmazonFSxConsoleReadOnlyAccess.json Added "ec2:DescribeNetworkInterfaces" to the Action array.
docs/.../SageMakerStudioBedrockFunctionExecutionRolePolicy.json,
docs/.../SageMakerStudioBedrockKnowledgeBaseCustomResourcePolicy.json,
docs/.../SageMakerStudioBedrockKnowledgeBaseServiceRolePolicy.json
New policy files created for SageMaker Studio Bedrock roles, defining permissions for services such as Secrets Manager, KMS, OpenSearch, and S3 with condition-based access.
docs/.../index.json Removed trailing newline (formatting adjustment).

Possibly related PRs


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab9e036 and 9cdece1.

⛔ Files ignored due to path filters (2)
  • lib/generated/aws-managed-policies/cdk-iam-floyd.ts is excluded by !**/generated/**
  • lib/generated/aws-managed-policies/iam-floyd.ts is excluded by !**/generated/**
📒 Files selected for processing (5)
  • docs/source/_static/managed-policies/AmazonFSxConsoleReadOnlyAccess.json (1 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioBedrockFunctionExecutionRolePolicy.json (1 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioBedrockKnowledgeBaseCustomResourcePolicy.json (1 hunks)
  • docs/source/_static/managed-policies/SageMakerStudioBedrockKnowledgeBaseServiceRolePolicy.json (1 hunks)
  • docs/source/_static/managed-policies/index.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/source/_static/managed-policies/index.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test cdk-iam-floyd
  • GitHub Check: Automerge CI
🔇 Additional comments (12)
docs/source/_static/managed-policies/AmazonFSxConsoleReadOnlyAccess.json (1)

11-13: Expanded EC2 Permissions
The new permission "ec2:DescribeNetworkInterfaces" has been added to the Action array. This update appears to extend the read-only capabilities for EC2 network interfaces in line with AWS best practices. Please confirm that the inclusion of this permission is intentional and that its scope aligns with your security requirements, ensuring no unintended access is granted.

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

1-17: OpenSearch Serverless Permissions Block Review
This new statement correctly grants the "aoss:APIAccessAll" action on collections by targeting ARNs that match arn:aws:aoss:*:*:collection/*. The conditions, checking for equality on the resource account and a string-like match ("bedrock*") on the collection name, are well scoped to ensure that only the desired resources are affected.


18-33: Bedrock Knowledge Base Permissions Block Review
This statement permits the Bedrock ingestion operations (GetIngestionJob, ListIngestionJobs, and StartIngestionJob) on resources under arn:aws:bedrock:*:*:knowledge-base/*. The condition correctly enforces that access is limited to resources tagged based on the principal’s account and the AmazonDataZoneProject tag. This precise scoping is appropriate for securing access to Bedrock knowledge-base resources.

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

1-11: SecretsManager Read Permissions Block Review
This newly added block grants permissions for "secretsmanager:DescribeSecret" and "secretsmanager:GetSecretValue" on secrets whose ARNs start with "arn:aws:secretsmanager:*:*:secret:amazon-bedrock*". The accompanying condition that validates both the resource account and the AmazonDataZoneProject tag is a strong security measure to restrict access appropriately.


12-18: KMS Decrypt via Secrets Manager Block Review
This block allows the "kms:Decrypt" action on KMS keys identified by the principal’s KmsKeyId tag. The condition is twofold: it requires that the call originates through the Secrets Manager service (validated via "kms:ViaService") and that the encryption context matches a specific ARN pattern. This extra guard helps mitigate potential misuse of decryption privileges.

docs/source/_static/managed-policies/SageMakerStudioBedrockKnowledgeBaseServiceRolePolicy.json (7)

1-18: Bedrock App Inference Profile Invocation Permissions Review
This statement authorizes actions related to Bedrock inference profiles—including getting an inference profile and invoking models—on resources specified by arn:aws:bedrock:*:*:application-inference-profile/*. It appropriately restricts access by enforcing that the resource tag AmazonDataZoneProject matches the principal tag. This strong tag-based condition is an effective way to ensure that only authorized principals can perform these actions.


19-36: Bedrock Model Invocation Permission Review
This segment grants model invocation permissions across multiple model types (foundation-model, custom-model, and provisioned-model) with an important condition ensuring that an inference profile ARN is present (i.e. not null). This check is critical in confirming that only properly provisioned or configured requests can trigger these actions, which enhances security.


37-50: OpenSearch Serverless Permissions Confirmation
This block parallels the similar statement in the other policy (see file 1) by granting "aoss:APIAccessAll" on collections. The combined use of account equality and a string-like match ("bedrock*") on the collection name ensures that the permissions are narrowly tailored.


51-72: List Domain S3 Bucket Permissions Review
This statement provides the "s3:ListBucket" action on the bucket defined dynamically via the DomainBucketName tag. The conditions enforce that the resource account is correct, the S3 object prefix follows a prescribed pattern based on domain and project tags, and that none of the critical tags are empty. This multi-factored condition is a robust way to prevent misconfiguration or unintended access.


73-91: Access Domain S3 Bucket Permissions Review
Here, the policy enables "s3:GetObject" and "s3:GetObjectVersion" on objects within a bucket path constructed from several principal tags. Conditions ensure the request only proceeds if the resource account matches and none of the essential tags (DomainBucketName, AmazonDataZoneDomain, AmazonDataZoneProject) are empty. This setup is well-designed to tightly control access to sensitive S3 objects.


92-108: Bedrock Knowledge Base KMS Permissions Review
This section grants both decryption and data key generation permissions on KMS keys identified via the KmsKeyId tag. The restrictions include confirming the resource account and applying a string-like match on the encryption context to bind the usage to Bedrock knowledge base resources. Ensure that the exact key in the encryption context (aws:bedrock:arn) matches your implementation’s expectations.


109-128: S3 KMS Permissions Review
The final statement restricts "kms:Decrypt" actions that are specifically routed through S3. It uses conditions to validate that the call comes via an S3 service URL and that the encryption context reflects the S3 bucket associated with the domain tag. This ensures decryption keys are used solely for S3 operations as intended.


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 merged commit 5538f01 into main Feb 26, 2025
9 checks passed
@udondan udondan deleted the update-aws-managed-policies branch February 26, 2025 01:40
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