feat(bedrock): add bedrock_agent_role_least_privilege check#11335
Open
ARYAN03B wants to merge 3 commits into
Open
feat(bedrock): add bedrock_agent_role_least_privilege check#11335ARYAN03B wants to merge 3 commits into
ARYAN03B wants to merge 3 commits into
Conversation
Contributor
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
ARYAN03B
added a commit
to ARYAN03B/prowler
that referenced
this pull request
May 22, 2026
PR opened as prowler-cloud#11335; fill in the link in the [5.28.0] Added entry.
Adds a new AWS check that flags Bedrock Agent execution roles which violate least privilege: - AWS-managed *FullAccess policies attached, or - inline statements granting broad actions on Resource:"*", or - no permissions boundary configured. Risk model: an overly permissive agent role turns successful prompt injection into AWS privilege escalation. Service-layer changes to support the check: - iam_service.Role gains a permissions_boundary field, populated from the existing list_roles response. - BedrockAgent service captures each agent's agentResourceRoleArn via a per-agent GetAgent call. Includes 6 test cases covering compliant role, *FullAccess attached, broad Resource:* inline, missing boundary, and unresolvable role. Refs prowler-cloud#11011 (VPC condition keys deferred to a follow-up PR).
v5.28.0 was cut while this PR was in draft; move our entry from the now-released [5.28.0] section to the [5.29.0] UNRELEASED section. Also fills in the real PR number (prowler-cloud#11335) instead of the placeholder.
d6fbfff to
75f92b8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Implements the new check requested in #11011 — flags AWS Bedrock Agent execution roles that violate least-privilege principles.
The 4th criterion from the issue (VPC condition keys when applicable) is intentionally deferred to a follow-up PR per discussion in the issue thread, so smaller/focused review.
Refs #11011
Description
Adds
bedrock_agent_role_least_privilegefor the AWS provider. A Bedrock Agent's execution role FAILs the check when any of these are true:*FullAccesspolicy is attached.s3:*,iam:*,*) onResource: "*".Risk model: a permissive agent role turns successful prompt injection into AWS privilege escalation — the LLM can be coerced into calling any API the role allows. Least privilege + a permissions boundary bounds the blast radius even when guardrails fail.
Service-layer changes (touching shared files):
iam_service.Rolegains apermissions_boundary: Optional[dict]field, populated from the existinglist_rolesresponse. Real AWS returns this field onListRoles, so no extra API call is added in production.BedrockAgentservice captures each agent'sagentResourceRoleArnvia a new per-agentGetAgentcall (theListAgentssummary doesn't include it).Check logic:
bedrock_agent_clientandiam_client(same pattern asbedrock_full_access_policy_attached).BROAD_ACTION_PATTERNSheuristic — only flags actions likes3:*/iam:*/*onResource:*, not narrow actions likes3:GetObject. Happy to widen or narrow based on review.No new dependencies.
Steps to review
iam_service.pydiff — 2-line addition (new field onRole, populate fromlist_rolesresponse). Confirms no behaviour change for existing IAM checks.bedrock_service.pydiff — new_get_agentmethod (modelled on_get_prompt) +role_arnfield onAgent.bedrock_agent_role_least_privilege.py— main logic +BROAD_ACTION_PATTERNSheuristic.bedrock_agent_role_least_privilege.metadata.json— title, severity (high), risk, remediation.*FullAccessattached,Resource:*broad action, no permissions boundary, unresolvable role.A note on the test mocks: moto's
bedrock-agentsupport is incomplete (GetAgentdoesn't echo backagentResourceRoleArn), and moto'sListRolesstripsPermissionsBoundaryeven when set (real AWS returns it). The test file uses the samemock_make_api_callpattern already used bybedrock_agent_guardrail_enabled_test.pyto work around these gaps without changing production code.Checklist
Community Checklist
SDK/CLI
bedrock_agent_role_least_privilege.bedrock:Get*wildcard inpermissions/prowler-additions-policy.json(thebedrock-agentservice uses thebedrock:IAM action prefix). IAM read perms are inherited from the AWS-managedSecurityAuditpolicy.UI
N/A — SDK-only change.
API
N/A — SDK-only change.
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.