---
title: >-
  Bedrock service role trust policies should restrict the source account and
  source ARN
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Bedrock service role trust policies
  should restrict the source account and source ARN
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Bedrock service role trust policies should restrict the source account and source ARN
 
## Description{% #description %}

IAM roles that Amazon Bedrock (`bedrock.amazonaws.com`) or Amazon Bedrock AgentCore (`bedrock-agentcore.amazonaws.com`) can assume should restrict each trust statement that grants the service `sts:AssumeRole` with `aws:SourceAccount` and `aws:SourceArn` conditions, which prevents the confused deputy problem. A statement passes when it has both conditions, every `aws:SourceAccount` value is the account that owns the role and every `aws:SourceArn` value is an ARN in that account with a concrete resource type, such as `agent/*` or `knowledge-base/<id>` for Bedrock and `runtime/<id>` for AgentCore. For Bedrock, the resource type must be one that CIS lists: `agent`, `flow`, `knowledge-base`, `model-customization-job`, `model-import-job`, `model-invocation-job`, or `evaluation-job`. An account-wide ARN such as `arn:aws:bedrock:*:<account-id>:*` fails, which is stricter than the AWS confused deputy guidance, and so do an empty condition value list and a trust policy that is not valid JSON. The one exception is the model invocation logging delivery role, which the Amazon Bedrock User Guide pins to `arn:aws:bedrock:<region>:<account-id>:*` because logging is configured per account and Region. That role passes with a literal Region, the owning account, and a matching `aws:SourceAccount` only when every attached policy is a collected customer managed policy and its policies, including inline policies, grant nothing beyond `logs:CreateLogStream` and `logs:PutLogEvents`. Service-linked roles (under `/aws-service-role/`) and roles that do not trust a Bedrock principal are skipped.

## Remediation{% #remediation %}

Edit the role's trust policy so that each statement allowing a Bedrock service principal includes a condition block similar to the following, with the source ARN scoped to the resource type or resource that uses the role:

```json
"Condition": {
  "StringEquals": { "aws:SourceAccount": "<ACCOUNT_ID>" },
  "ArnLike": { "aws:SourceArn": "arn:aws:bedrock:<REGION>:<ACCOUNT_ID>:agent/*" }
}
```

For more information, see [Cross-service confused deputy prevention](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-service-confused-deputy-prevention.html) in the Amazon Bedrock User Guide.

## References{% #references %}

- [Cross-service confused deputy prevention](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-service-confused-deputy-prevention.html)
- [Monitor model invocation using CloudWatch Logs and Amazon S3](https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html)
- [CIS Amazon Web Services Benchmarks](https://www.cisecurity.org/benchmark/amazon_web_services)
