QuestionQ98

VerifiedAI Safety, Security, and Governance

A financial services company is developing a generative AI application that lets business analysts query sensitive customer data using natural language. A GenAI developer needs to implement a content safety framework that performs text-to-SQL transformations while preventing harmful outputs. The solution must:

  • Detect and block SQL injection attempts embedded in natural language prompts
  • Validate generated SQL queries against predefined schemas
  • Create an audit trail of query transformations

Which solution will meet these requirements?

Explanation

Amazon Bedrock Guardrails is designed to filter and detect undesirable or malicious content in user inputs (including prompt-injection style attacks) before it reaches the foundation model, addressing the SQL-injection detection requirement at the natural-language stage. Pairing this with AWS Lambda functions that use SQL parsing libraries allows syntactic and semantic validation of the generated SQL statements, catching injection patterns or disallowed operations. The Amazon RDS Data API can be used both to verify that generated queries conform to the defined database schema (correct tables, columns, and structure) and to collect audit logs of the query transformations prior to executing each query against the database, satisfying the audit-trail requirement. This multi-stage pipeline — input filtering, syntax validation, schema verification, and audit logging — mirrors AWS's recommended architecture pattern for building secure, governed text-to-SQL generative AI applications on Bedrock. The other options misapply AWS services: GuardDuty and Parameter Store are not designed for natural-language SQL-injection detection or schema validation; CloudTrail/IAM/WAF alone lack text-to-SQL-specific validation and schema checks; and a custom SageMaker model with VPC endpoints and DynamoDB storage does not inherently provide content-safety filtering, SQL syntax/schema validation, or a structured audit trail of transformations.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!