feat(aws): add bedrock_prompt_encrypted_with_cmk security check#10905
feat(aws): add bedrock_prompt_encrypted_with_cmk security check#10905danibarranqueroo wants to merge 5 commits intomasterfrom
Conversation
Add new security check bedrock_prompt_have_multiple_variants for aws provider. Includes check implementation, metadata, and unit tests.
|
✅ All necessary |
591ff3b to
2854a74
Compare
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
Compliance Mapping ReviewThis PR adds new checks. Please verify that they have been mapped to the relevant compliance framework requirements. New checks already mapped in this PR
Use the |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #10905 +/- ##
==========================================
+ Coverage 6.61% 7.72% +1.10%
==========================================
Files 849 850 +1
Lines 24579 24621 +42
==========================================
+ Hits 1627 1901 +274
+ Misses 22952 22720 -232
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🔒 Container Security ScanImage: 📊 Vulnerability Summary
4 package(s) affected
|
Context
Amazon Bedrock prompts managed via Prompt Management can contain sensitive instructions, business logic, and references to downstream tooling. When a prompt is left with the AWS-owned default key, the tenant has no control over the key policy that governs decrypt permissions, no control over rotation cadence, and no auditable trail tied to a customer-managed KMS key. Multiple frameworks (ISO 27001 A.8.24, NIST CSF PR.DS-1, KISA-ISMS-P 2.7.2) require customer-managed cryptographic keys for sensitive data at rest, so prompts encrypted only with the default key create both a control gap and a compliance gap.
Description
This check verifies that each Amazon Bedrock prompt is encrypted at rest with a customer-managed KMS key (CMK). For every prompt collected from
ListPrompts, the service layer callsGetPromptand readscustomerEncryptionKeyArn. The check reports a PASS when that ARN is present and a FAIL when it is absent (i.e. the prompt falls back to the AWS-owned key). The recommended remediation is to callbedrock-agent update-prompt --customer-encryption-key-arn <kms_key_arn>against an org-controlled CMK whose key policy is scoped to the principals that legitimately need to author or invoke prompts.This PR also extends
BedrockAgentinbedrock_service.pywith a_get_promptthreading call and addscustomer_encryption_key_arnto thePromptmodel. The_list_promptscollection is kept aligned with #10878 (same shape, same defensive accessors, sameprompt_scanned_regionstracking, noaudit_resourcesfiltering) so the two PRs compose cleanly: regardless of merge order, the second one only contributes its additive piece without conflicting on the shared scaffolding.Note on previous direction
This branch originally implemented
bedrock_prompt_have_multiple_variants. That check was dropped after review — the AWS [CreatePrompt(https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreatePrompt.html) andGetPromptAPIs both cap thevariantsarray at "Maximum 1 item", which made the original PASS condition (len(variants) > 1) unreachable in real AWS and the resilience-control compliance mappings unsupportable. Pivoting to CMK encryption preserves the per-prompt scaffolding while moving the check onto an attribute the API actually persists, with compliance mappings that align cleanly to data-at-rest controls.Steps to review
prowler/providers/aws/services/bedrock/bedrock_prompt_encrypted_with_cmk/prowler/providers/aws/services/bedrock/bedrock_service.py— confirm that_list_promptsis byte-identical to the version proposed in#10878 and that
_get_prompt+customer_encryption_key_arnare purely additiveresilience-control mappings from the previous direction are removed
poetry run pytest tests/providers/aws/services/bedrock/bedrock_prompt_encrypted_with_cmk/ -vChecklist
Community Checklist
SDK/CLI
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.