# iac-ai-services-cfn-v1

> iac-ai-services-cfn-v1: 12 Keryn rules for yaml, json (2 error, 10 warning).

Source: https://keryn.dev/rules/iac-ai-services-cfn-v1/

12 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do not.

- **Confidence**: **P0** exploitable as written; **P1** dangerous in context; **P2** a heuristic or a posture check: confirm by reading the code.

- **False-positive risk**: **low**: an exact API or flag, so hits are almost always real; **medium**: the pattern is legitimate in many programs, so check each hit; **high**: it finds a lead to confirm, so expect benign hits.

- **Edge**: The relationship the finding sits on. **reaches**: content or traffic gets to a thing; **calls**: one thing invokes another; **reads**: one thing reads from another; **writes**: one thing writes to another; **sends**: data leaves for another party; **grants**: authority is given or left unchecked; **depends_on**: something relies on a component it does not verify; **trusts**: one party believes another without evidence. The boundary it crosses, when there is one: **user->prompt** (untrusted input reaching a prompt); **model->code** (model output reaching code, a shell, a query or a page); **secret->outside** (a secret leaving the trusted side); **supply-chain** (code, models or prompts pulled in from outside).

- **Taxonomy chips**: References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

## seceng.iacai.cfn-bedrock-agent-no-guardrail

`warning` yaml cloudformation, aws, bedrock

CloudFormation `AWS::Bedrock::Agent` has no `GuardrailConfiguration`, so prompts and responses reach the model with no content, PII or prompt-attack filtering at the Bedrock layer. Attach an `AWS::Bedrock::Guardrail` (with a PROMPT\_ATTACK filter) to the agent.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Add GuardrailConfiguration with GuardrailIdentifier and GuardrailVersion (for example !Ref and !GetAtt of an AWS::Bedrock::Guardrail) to the agent's Properties.

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-bedrock-agent.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-bedrock-agent.html) · [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html)

## seceng.iacai.cfn-bedrock-guardrail-filter-strength-none

`warning` yaml cloudformation, aws, bedrock

CloudFormation `AWS::Bedrock::Guardrail` content filter has strength `NONE` for one direction, which turns that filter off. Use at least MEDIUM.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Set InputStrength and OutputStrength to MEDIUM or HIGH on every content filter (PROMPT\_ATTACK is covered by its own rule: its OutputStrength must be NONE).

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrock-guardrail-contentfilterconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrock-guardrail-contentfilterconfig.html)

## seceng.iacai.cfn-bedrock-guardrail-prompt-attack-none

`warning` yaml cloudformation, aws, bedrock

CloudFormation `AWS::Bedrock::Guardrail` PROMPT\_ATTACK filter has `InputStrength: NONE`, so jailbreak and prompt-injection detection is off. Use HIGH.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-1427](https://keryn.dev/taxonomies/cwe/#cwe-1427-improper-neutralization-of-input-used-for-llm-prompting) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Set InputStrength: HIGH on the PROMPT\_ATTACK filter.

**References:** [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html)

## seceng.iacai.cfn-sagemaker-endpoint-config-no-kms

`warning` yaml cloudformation, aws, sagemaker

CloudFormation `AWS::SageMaker::EndpointConfig` has no `KmsKeyId`, so the endpoint's attached storage and captured inference payloads (prompts, completions) are encrypted only with an AWS-managed key you cannot control or audit. Set a customer-managed KMS key.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-311](https://keryn.dev/rules/?cwe=CWE-311) [CWE-320](https://keryn.dev/rules/?cwe=CWE-320) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set KmsKeyId to a customer-managed key (and DataCaptureConfig.KmsKeyId if capture is enabled).

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-endpointconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-endpointconfig.html)

## seceng.iacai.cfn-sagemaker-notebook-direct-internet

`warning` yaml cloudformation, aws, sagemaker

CloudFormation `AWS::SageMaker::NotebookInstance` has `DirectInternetAccess: Enabled`, giving the notebook (which holds model artifacts and credentials) a path to and from the public internet outside your VPC controls. Set it to Disabled and route through a NAT or VPC endpoints.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set DirectInternetAccess: Disabled, give the notebook a SubnetId, and reach package mirrors through VPC endpoints or a controlled egress path.

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-notebookinstance.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-notebookinstance.html)

## seceng.iacai.cfn-bedrock-iam-wildcard-action-resource

`error` yaml cloudformation, aws, bedrock, iam

IAM policy statement allows `bedrock:*` on `Resource: "*"` (CloudFormation or policy JSON). An agent role with it can invoke any model, edit agents and guardrails and read knowledge bases; a prompt-injected agent inherits all of it. Scope actions to bedrock:InvokeModel and similar, on specific ARNs.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-250](https://keryn.dev/taxonomies/cwe/#cwe-250-execution-with-unnecessary-privileges) [CWE-269](https://keryn.dev/rules/?cwe=CWE-269) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** List the specific actions (bedrock:InvokeModel, bedrock:Retrieve) and restrict Resource to the exact model, guardrail and knowledge-base ARNs; add a permissions boundary and aws:SourceArn conditions for the agent's service role.

**References:** [https://docs.aws.amazon.com/bedrock/latest/userguide/security-iam.html](https://docs.aws.amazon.com/bedrock/latest/userguide/security-iam.html)

## seceng.iacai.cfn-bedrock-agent-no-guardrail-json

`warning` json cloudformation, aws, bedrock

CloudFormation `AWS::Bedrock::Agent` has no `GuardrailConfiguration`, so prompts and responses reach the model with no content, PII or prompt-attack filtering at the Bedrock layer. Attach an `AWS::Bedrock::Guardrail` (with a PROMPT\_ATTACK filter) to the agent.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Add GuardrailConfiguration with GuardrailIdentifier and GuardrailVersion (for example !Ref and !GetAtt of an AWS::Bedrock::Guardrail) to the agent's Properties.

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-bedrock-agent.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-bedrock-agent.html) · [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html)

## seceng.iacai.cfn-bedrock-guardrail-filter-strength-none-json

`warning` json cloudformation, aws, bedrock

CloudFormation `AWS::Bedrock::Guardrail` content filter has strength `NONE` for one direction, which turns that filter off. Use at least MEDIUM.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Set InputStrength and OutputStrength to MEDIUM or HIGH on every content filter (PROMPT\_ATTACK is covered by its own rule: its OutputStrength must be NONE).

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrock-guardrail-contentfilterconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrock-guardrail-contentfilterconfig.html)

## seceng.iacai.cfn-bedrock-guardrail-prompt-attack-none-json

`warning` json cloudformation, aws, bedrock

CloudFormation `AWS::Bedrock::Guardrail` PROMPT\_ATTACK filter has `InputStrength: NONE`, so jailbreak and prompt-injection detection is off. Use HIGH.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-1427](https://keryn.dev/taxonomies/cwe/#cwe-1427-improper-neutralization-of-input-used-for-llm-prompting) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Set InputStrength: HIGH on the PROMPT\_ATTACK filter.

**References:** [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html)

## seceng.iacai.cfn-sagemaker-endpoint-config-no-kms-json

`warning` json cloudformation, aws, sagemaker

CloudFormation `AWS::SageMaker::EndpointConfig` has no `KmsKeyId`, so the endpoint's attached storage and captured inference payloads (prompts, completions) are encrypted only with an AWS-managed key you cannot control or audit. Set a customer-managed KMS key.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-311](https://keryn.dev/rules/?cwe=CWE-311) [CWE-320](https://keryn.dev/rules/?cwe=CWE-320) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set KmsKeyId to a customer-managed key (and DataCaptureConfig.KmsKeyId if capture is enabled).

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-endpointconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-endpointconfig.html)

## seceng.iacai.cfn-sagemaker-notebook-direct-internet-json

`warning` json cloudformation, aws, sagemaker

CloudFormation `AWS::SageMaker::NotebookInstance` has `DirectInternetAccess: Enabled`, giving the notebook (which holds model artifacts and credentials) a path to and from the public internet outside your VPC controls. Set it to Disabled and route through a NAT or VPC endpoints.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set DirectInternetAccess: Disabled, give the notebook a SubnetId, and reach package mirrors through VPC endpoints or a controlled egress path.

**References:** [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-notebookinstance.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-sagemaker-notebookinstance.html)

## seceng.iacai.cfn-bedrock-iam-wildcard-action-resource-json

`error` json cloudformation, aws, bedrock, iam

IAM policy statement allows `bedrock:*` on `Resource: "*"` (CloudFormation or policy JSON). An agent role with it can invoke any model, edit agents and guardrails and read knowledge bases; a prompt-injected agent inherits all of it. Scope actions to bedrock:InvokeModel and similar, on specific ARNs.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-250](https://keryn.dev/taxonomies/cwe/#cwe-250-execution-with-unnecessary-privileges) [CWE-269](https://keryn.dev/rules/?cwe=CWE-269) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** List the specific actions (bedrock:InvokeModel, bedrock:Retrieve) and restrict Resource to the exact model, guardrail and knowledge-base ARNs; add a permissions boundary and aws:SourceArn conditions for the agent's service role.

**References:** [https://docs.aws.amazon.com/bedrock/latest/userguide/security-iam.html](https://docs.aws.amazon.com/bedrock/latest/userguide/security-iam.html)
