-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bedrock): add checks for guardrails configuration and log encryption #5385
Conversation
…ng-on-aws-gen-ai-service
…ng-on-aws-gen-ai-service
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5385 +/- ##
========================================
Coverage 89.43% 89.44%
========================================
Files 1027 1030 +3
Lines 31531 31641 +110
========================================
+ Hits 28200 28301 +101
- Misses 3331 3340 +9 ☔ View full report in Codecov by Sentry. |
for filter in guardrail_info.get("contentPolicy", {}).get("filters", []): | ||
if filter.get("type") == "PROMPT_ATTACK": | ||
guardrail.prompt_attack_filter_strength = filter.get( | ||
"inputStrength", None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"inputStrength", None | |
"inputStrength", "NONE" |
) | ||
|
||
|
||
def mock_make_api_call(self, operation_name, kwarg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that functions should use a name more characteristic of their behaviour than v2 and v3.
return make_api_call(self, operation_name, kwarg) | ||
|
||
|
||
def mock_make_api_call_v2(self, operation_name, kwarg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def mock_make_api_call_v2(self, operation_name, kwarg): | |
def mock_make_api_call_no_filters(self, operation_name, kwarg): |
return make_api_call(self, operation_name, kwarg) | ||
|
||
|
||
def mock_make_api_call_v3(self, operation_name, kwarg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def mock_make_api_call_v3(self, operation_name, kwarg): | |
def mock_make_api_call_filter_strength_low(self, operation_name, kwarg): |
) | ||
|
||
|
||
def mock_make_api_call(self, operation_name, kwarg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could change all the mock_make_api_call_vX
in all tests for more descriptive names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! 💯
Context
This PR addresses security concerns for Amazon Bedrock by introducing three new checks to strengthen protection against prompt attacks, sensitive data exposure, and log security. These checks aim to mitigate the risks associated with generative AI infrastructures being targeted by adversaries.
Description
This PR adds the following three checks:
bedrock_guardrail_prompt_attack_filter_enabled
Ensures the prompt attack filter is set to the highest strength to protect models from malicious prompts.
bedrock_guardrail_sensitive_information_filter_enabled
Verifies sensitive information filters are enabled to prevent data leakage in model outputs.
bedrock_model_invocation_logs_encryption_enabled
Ensures invocation logs are encrypted with AWS KMS to protect sensitive log data from unauthorized access.
These checks enhance Bedrock's security and data protection.
Checklist
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.