Skip to content

Commit 8f7ef7e

Browse files
committed
update config rule annotation wording
1 parent a82f99a commit 8f7ef7e

File tree

4 files changed

+12
-9
lines changed
  • aws_sra_examples/solutions/genai/bedrock_org/lambda/rules
    • sra_bedrock_check_eval_job_bucket
    • sra_bedrock_check_guardrails
    • sra_bedrock_check_iam_user_access
    • sra_bedrock_check_invocation_log_s3

4 files changed

+12
-9
lines changed

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_eval_job_bucket/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ def evaluate_compliance(event: dict, context: Any) -> tuple[str, str]: # noqa:
9494
encryption = s3.get_bucket_encryption(Bucket=bucket_name)
9595
if "ServerSideEncryptionConfiguration" not in encryption:
9696
compliance_type = "NON_COMPLIANT"
97-
annotation.append("KMS CMK encryption not enabled")
97+
annotation.append("KMS customer-managed key encryption not enabled")
9898
except ClientError:
9999
compliance_type = "NON_COMPLIANT"
100-
annotation.append("KMS CMK encryption not enabled")
100+
annotation.append("KMS customer-managed key encryption not enabled")
101101

102102
# Check logging
103103
if check_logging:

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_guardrails/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ def lambda_handler(event: dict, context: Any) -> dict: # noqa: CCR001, C901, U1
110110
if compliant_guardrails:
111111
compliance_type = "COMPLIANT"
112112
if len(compliant_guardrails) == 1:
113-
annotation = f"The following Bedrock guardrail contains all required features: {compliant_guardrails[0]}"
113+
annotation = f"The following Bedrock Guardrail contains all required features: {compliant_guardrails[0]}"
114114
else:
115-
annotation = f"The following Bedrock guardrails contain all required features: {', '.join(compliant_guardrails)}"
115+
annotation = f"The following Bedrock Guardrails contain all required features: {', '.join(compliant_guardrails)}"
116116
LOGGER.info(f"Account is COMPLIANT. {annotation}")
117117
else:
118118
compliance_type = "NON_COMPLIANT"
119-
annotation = "No Bedrock guardrails contain all required features. "
119+
annotation = "No Bedrock Guardrails exist in this account that meet all required features. "
120120
for guardrail, missing in non_compliant_guardrails.items(): # type: ignore
121121
annotation += f" [{guardrail} is missing {', '.join(missing)}]"
122122
LOGGER.info(f"Account is NON_COMPLIANT. {annotation}")

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_iam_user_access/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ def evaluate_compliance(event: dict, context: Any) -> dict: # noqa: CCR001, U10
9393
# Prepare the evaluation result
9494
if non_compliant_users:
9595
compliance_type = "NON_COMPLIANT"
96-
annotation = "The following IAM users have access to the Amazon Bedrock service: " + ", ".join(non_compliant_users)
96+
annotation = (
97+
"IAM users should not have direct access to Amazon Bedrock. These users have access and should use roles instead: "
98+
+ ", ".join(non_compliant_users)
99+
)
97100
else:
98101
compliance_type = "COMPLIANT"
99102
annotation = "No IAM users have access to the Amazon Bedrock service."

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_invocation_log_s3/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def evaluate_compliance(rule_parameters: dict) -> tuple[str, str]: # noqa: CFQ0
6363
LOGGER.info(f"Bedrock Model Invocation S3 bucketName: {bucket_name}")
6464
BUCKET_NAME = bucket_name
6565
if not s3_config or not bucket_name:
66-
return "NON_COMPLIANT", "S3 logging is not enabled for Bedrock Model Invocation Logging"
66+
return "NON_COMPLIANT", "S3 logging destination is not enabled for Bedrock Model Invocation Logging"
6767

6868
# Check S3 bucket configurations
6969
issues = []
@@ -107,8 +107,8 @@ def evaluate_compliance(rule_parameters: dict) -> tuple[str, str]: # noqa: CFQ0
107107
return "INSUFFICIENT_DATA", f"Error evaluating Object Lock configuration: {str(error)}"
108108

109109
if issues:
110-
return "NON_COMPLIANT", f"S3 logging to {BUCKET_NAME} enabled but {', '.join(issues)}"
111-
return "COMPLIANT", f"S3 logging properly configured for Bedrock Model Invocation Logging. Bucket: {bucket_name}"
110+
return "NON_COMPLIANT", f"S3 logging destination to {BUCKET_NAME} enabled but {', '.join(issues)}"
111+
return "COMPLIANT", f"S3 logging destination properly configured for Bedrock Model Invocation Logging. Bucket: {bucket_name}"
112112
except botocore.exceptions.ClientError as client_error:
113113
LOGGER.error(f"Error evaluating Bedrock Model Invocation Logging configuration: {str(client_error)}")
114114
return "INSUFFICIENT_DATA", f"Error evaluating compliance: {str(client_error)}"

0 commit comments

Comments
 (0)