Repository navigation
v0.5.0 — Prompt Injection Scanning
What's New
Prompt Injection Scanning
Optional AI-powered scanning of uploaded documents for prompt injection attacks. When enabled, files that pass GuardDuty malware scanning are additionally scanned using the protectai/deberta-v3-base-prompt-injection-v2 ONNX model before reaching the egress bucket.
Supported formats: PDF, DOCX, PPTX, and plain text (TXT, CSV, MD, JSON, XML, HTML, YAML, LOG). Non-text files pass through with score 0.
How it works: The file router invokes a container-image Lambda synchronously. Text is extracted, tokenized into overlapping 512-token chunks, and scored by the model. Files scoring above the configurable threshold (default 80) are quarantined with an SNS alert.
Usage
module "secure_upload" {
source = "gofastercloud/secure-upload/aws"
name_prefix = "myapp"
enable_prompt_injection_scanning = true
# Optional tuning
prompt_injection_threshold = 80 # 0-100, default 80
prompt_injection_memory_size = 3008 # more memory = more CPU = faster cold starts
}New Variables
| Variable | Default | Description |
|---|---|---|
enable_prompt_injection_scanning |
false |
Enable the scanning pipeline |
prompt_injection_threshold |
80 |
Score (0-100) above which files are quarantined |
prompt_injection_memory_size |
3008 |
Scanner Lambda memory in MB |
prompt_injection_timeout |
120 |
Scanner Lambda timeout in seconds |
prompt_injection_reserved_concurrency |
5 |
Scanner Lambda concurrency |
prompt_injection_image_uri |
null |
BYO pre-built container image |
Other Changes
- File router timeout auto-adjusts to
scanner_timeout + 30swhen scanning is enabled - ECR repository with KMS encryption and lifecycle policy for scanner images
- 7 new validation tests (49 total)
- Documentation updated (README, ARCHITECTURE.md, CHANGELOG.md)
Full Changelog: v0.4.0...v0.5.0