AWS Security ChangesHomeSearch

AWS bedrock high security documentation change

Service: bedrock · 2025-03-30 · Security-related high

File: bedrock/latest/userguide/guardrails-mmfilter.md

Summary

Updated image content filter documentation with expanded regional availability, added Misconduct and Prompt Attack categories, technical implementation details, and integration examples with image generation models

Security assessment

Added explicit documentation about detecting 'Prompt Attack' category to prevent model jailbreaking/prompt injection attacks. Expanded violence detection to include weapon imagery. Code examples demonstrate blocking harmful content generation (e.g., 'A gun'). These changes directly address security controls against adversarial inputs and harmful outputs.

Diff

diff --git a/bedrock/latest/userguide/guardrails-mmfilter.md b/bedrock/latest/userguide/guardrails-mmfilter.md
index 2f47f4b90..8baa5cd21 100644
--- a/bedrock/latest/userguide/guardrails-mmfilter.md
+++ b/bedrock/latest/userguide/guardrails-mmfilter.md
@@ -5 +5 @@
-Using the image content filterConfiguring content filters for images with APIConfiguring the image filter to work with ApplyGuardrail API
+Using the image content filterConfiguring content filters for images with APIConfiguring the image filter to work with ApplyGuardrail APIConfiguring the image filter to work with Image generation models 
@@ -7 +7 @@ Using the image content filterConfiguring content filters for images with APICon
-# Block harmful images with the image content filters
+# Block harmful images with content filters
@@ -9,7 +9 @@ Using the image content filterConfiguring content filters for images with APICon
-###### Note
-
-Guardrails image content filters for Amazon Bedrock is in preview release, and is subject to change.
-
-**Block harmful images with content filters (Preview)**
-
-Amazon Bedrock Guardrails can help block inappropriate or harmful images by enabling image as a modality while configuring content filters within a guardrail.
+Amazon Bedrock Guardrails can help block inappropriate or harmful images while configuring content filters within a guardrail.
@@ -19,2 +12,0 @@ Amazon Bedrock Guardrails can help block inappropriate or harmful images by enab
-  * The support to detect and block harmful images in content filters is currently in preview and not recommended for production workloads.
-
@@ -23 +15,5 @@ Amazon Bedrock Guardrails can help block inappropriate or harmful images by enab
-  * This capability is only supported for Hate, Insults, Sexual, and Violence categories within content filters, and not for any other categories including misconduct and prompt attacks.
+  * This capability is generally available in US East (N. Virginia), US West (Oregon), Europe (Frankfurt), and Asia Pacific (Tokyo) AWS regions, where it is supported for Hate, Insults, Sexual, Violence, Misconduct, and Prompt Attack categories within content filters.
+
+  * This capability is available in preview in US East (Ohio), Asia Pacific (Mumbai, Seoul, Singapore, Tokyo), Europe (Ireland, London), and US GovCloud (US-West) AWS regions, where it is supported for Hate, Insults, Sexual, and Violence categories within content filters.
+
+  * Maximum image dimensions allowed for the feature are 8000x8000 (for both JPEG and PNG files).
@@ -26,0 +23,2 @@ Amazon Bedrock Guardrails can help block inappropriate or harmful images by enab
+  * Default limit of 25 images per second. This value is not configurable.
+
@@ -34 +32 @@ Amazon Bedrock Guardrails can help block inappropriate or harmful images by enab
-The detection and blocking of harmful images is supported for Hate, Insults, Sexual, and Violence categories within content filters, and for images without any text in them. In addition to text, users can select the image modality for the above categories within content filters while creating a guardrail, and set the respective filtering strength to **NONE** , **LOW** , **MEDIUM** , or **HIGH**. These thresholds will be common to both text and image content for these categories, if both text and image are selected. Guardrails will evaluate images sent as an input by users, or generated as output from the model responses. 
+The detection and blocking of harmful images are supported for only images or images with text in them. While creating a guardrail, users can select the image option by itself or along with the text option, and set the respective filtering strength to **NONE** , **LOW** , **MEDIUM** , or **HIGH**. These thresholds will be common to both text and image content if both modalities are selected. Guardrails will evaluate images sent as an input by users, or generated as outputs from model responses.
@@ -36 +34 @@ The detection and blocking of harmful images is supported for Hate, Insults, Sex
-The four supported categories for detection of harmful image content are described below: 
+The supported categories for detection of harmful image content are described below: 
@@ -44,51 +42 @@ The four supported categories for detection of harmful image content are describ
-  * **Violence** – Describes content that includes glorification of or threats to inflict physical pain, hurt, or injury toward a person, group, or thing. 
-
-
-
-
-Amazon Bedrock Guardrails image content filter is supported in the following Regions (for more information about Regions supported in Amazon Bedrock see [Amazon Bedrock endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/bedrock.html)):
-
-  * US East (N. Virginia)
-
-  * US East (Ohio)
-
-  * US West (Oregon)
-
-  * AWS GovCloud (US-West)
-
-  * Asia Pacific (Tokyo)
-
-  * Asia Pacific (Seoul)
-
-  * Asia Pacific (Mumbai)
-
-  * Asia Pacific (Singapore)
-
-  * Asia Pacific (Sydney)
-
-  * Europe (Frankfurt)
-
-  * Europe (Ireland)
-
-  * Europe (London)
-
-
-
-
-Amazon Bedrock Guardrails image content filter is supported for the following foundation models (to see which Regions support each model, refer to [Supported foundation models in Amazon Bedrock](./models-supported.html)):
-
-  * Amazon Titan Image Generator G1 v2
-
-  * Amazon Titan Image Generator G1
-
-  * Anthropic Claude 3 Haiku
-
-  * Anthropic Claude 3 Opus
-
-  * Anthropic Claude 3 Sonnet
-
-  * Anthropic Claude 3.5 Sonnet
-
-  * Meta Llama 3.2 11B Instruct
-
-  * Meta Llama 3.2 90B Instruct
+  * **Violence** – Describes content that includes glorification of or threats to inflict physical pain, hurt, or injury toward a person, group, or thing. It also encompasses imagery related to weapons with the intent to harm. 
@@ -96 +44 @@ Amazon Bedrock Guardrails image content filter is supported for the following fo
-  * Stability AI Stable Image Core 1.0
+  * **Misconduct** – Describes input prompts and model responses that seeks or provides information about engaging in criminal activity, or harming, defrauding, or taking advantage of a person, group or institution. 
@@ -98 +46 @@ Amazon Bedrock Guardrails image content filter is supported for the following fo
-  * Stability AI Stable Image Ultra 1.0
+  * **Prompt Attack** – Describes user prompts intended to bypass the safety and moderation capabilities of a foundation model in order to generate harmful content (also known as jailbreak), and to ignore and to override instructions specified by the developer (referred to as prompt injection). Requires input tagging to be used in order for prompt attack to be applied. Prompt attacks detection requires input tags to be used.
@@ -110,0 +59,2 @@ Amazon Bedrock Guardrails image content filter is supported for the following fo
+  * Configuring the image filter to work with Image generation models 
+
@@ -118 +68,5 @@ Amazon Bedrock Guardrails image content filter is supported for the following fo
-While creating a new guardrail or updating an existing guardrail, users will now see an option to select image (in preview) in addition to the existing text option. The image option is available for Hate, Insults, Sexual, or Violence categories. (Note: By default, the text option is enabled, and the image option needs to be explicitly enabled. Users can choose both text and image or either one of them depending on the use case.
+While creating a new guardrail or updating an existing guardrail, users will now see an option to select image in addition to the existing text option.
+
+###### Note
+
+By default, the text option is enabled, and the image option needs to be explicitly enabled. Users can choose both text and image or either one of them depending on the use case.
@@ -126,4 +79,0 @@ Filtering is done based on the confidence classification of user inputs and FM r
-###### Note
-
-Image content filters are in preview and will not be available if the model does not use images for model prompts or responses.
-
@@ -273,0 +224,63 @@ You can update the request payload in below script for various models by followi
+    if __name__ == "__main__":
+        main()
+
+## Configuring the image filter to work with Image generation models 
+
+You can also use Amazon Bedrock Guardrails image filters with Image generation models like Titan Image Generator and Stability Image or Diffusion models. These models are currently supported through the InvokeModel API which can be invoked with a Guardrail. You can update the request payload in the below script for various models by following the inference parameters documentation for various bedrock foundation models that are supported by .
+    
+    
+    import base64
+            import boto3
+            import botocore
+            import json
+            import os
+            import random
+            import string
+            
+            
+            guardrail_id = 'guardrail-id'
+            guardrail_version = 'DRAFT'
+            
+            model_id = 'stability.sd3-large-v1:0'
+            output_images_folder = '/path/to/folder/'
+            
+            body = json.dumps(
+            {
+            "prompt": "Create an image of a beautiful flower", # Prompt for image generation ("A gun" should get blocked by violence)
+            "output_format": "jpeg"
+            }
+            )
+            
+            
+            def main():
+            bedrock_runtime_client = boto3.client("bedrock-runtime", region_name="us-west-2")
+            try:
+            print("Making a call to InvokeModel API for model: {}".format(model_id))
+            response = bedrock_runtime_client.invoke_model(
+            body=body,
+            modelId=model_id,
+            trace='ENABLED',
+            guardrailIdentifier=guardrail_id,
+            guardrailVersion=guardrail_version
+            )
+            response_body = json.loads(response.get('body').read())
+            print("Received response from InvokeModel API (Request Id: {})".format(response['ResponseMetadata']['RequestId']))
+            if 'images' in response_body and len(response_body['images']) > 0:
+            os.makedirs(output_images_folder, exist_ok=True)
+            images = response_body["images"]
+            for image in images:
+            image_id = ''.join(random.choices(string.ascii_lowercase + string.digits, k=6))
+            image_file = os.path.join(output_images_folder, "generated-image-{}.jpg".format(image_id))
+            print("Saving generated image {} at {}".format(image_id, image_file))
+            with open(image_file, 'wb') as image_file_descriptor:
+            image_file_descriptor.write(base64.b64decode(image.encode('utf-8')))
+            else:
+            print("No images generated from model")
+            guardrail_trace = response_body['amazon-bedrock-trace']['guardrail']
+            guardrail_trace['modelOutput'] = ['<REDACTED>']
+                print("Guardrail Trace: {}".format(json.dumps(guardrail_trace, indent=2)))
+                except botocore.exceptions.ClientError as err:
+                print("Failed while calling InvokeModel API with RequestId = {}".format(err.response['ResponseMetadata']['RequestId']))
+                raise err
+                
+                
@@ -283 +296 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please
-Contextual grounding check
+Content filters (Text)
@@ -285 +298 @@ Contextual grounding check
-Prerequisites for using guardrails
+Denied topics