This package allows you to test Prisma AIRS Runtime Security effectiveness by using AI Red Teaming to attack a protected test application.
Author: Scott Thornton
βββββββββββββββββββ
β AI Red Teaming β Sends attack prompts
β (Cloud-based) β
ββββββββββ¬βββββββββ
β
βΌ (via ngrok tunnel)
βββββββββββββββββββ
β Test App β Flask app on localhost:5000
β (This package) β
ββββββββββ¬βββββββββ
β
βΌ Scans all prompts
βββββββββββββββββββ
β Runtime β Blocks malicious, allows benign
β Security API β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β LLM Response β OpenAI or mock response
β (Optional) β
βββββββββββββββββββ
Goal: Validate that Runtime Security blocks Red Team attacks while allowing legitimate prompts through.
Deployment options:
- π³ Docker with ngrok - One command setup with automatic public URL
- π³ Docker without ngrok - Simple containerization for local or VM deployment
- βοΈ Cloud Run - Production deployment on GCP
- π» Cloud VMs - Simple VM deployment (GCP, Azure, or AWS) when Cloud Run auth blocks Red Teaming
- π Manual Setup - Traditional Python virtualenv
Prerequisites:
- Docker Desktop installed and running
- ngrok account (free) from https://ngrok.com
One-command setup:
# 1. Copy environment template
cp .env.example .env
# 2. Edit .env with your credentials:
# - PANW_AI_SEC_API_KEY
# - NGROK_AUTHTOKEN
# - PRISMA_AIRS_PROFILE
# 3. Start everything
./docker-quickstart.shThat's it! The container:
- Starts Flask app on port 5000
- Configures and starts ngrok tunnel
- Shows your public HTTPS URL
- Provides ngrok web UI at http://localhost:4040
See DOCKER_README.md for complete Docker documentation.
Simple Docker setup without ngrok - useful for local development or deploying to a VM.
Local development:
# 1. Configure environment
cp .env.example .env
# Edit .env with your credentials
# 2. Start container
./docker-simple-start.shAccess at http://localhost:5000 (local only, not accessible for Red Teaming).
Deploy to GCP VM: See DOCKER_SIMPLE.md for running Docker container on GCP VM with public IP.
Deploy to Google Cloud for production-like testing without ngrok:
5-minute setup:
# 1. Copy Cloud Run environment template
cp .env.cloudrun.example .env.cloudrun
# 2. Edit with your GCP project ID and API key
# 3. Deploy
./deploy-to-cloudrun.shReturns a permanent HTTPS URL for Red Teaming configuration.
See CLOUDRUN_QUICKSTART.md for details.
If Cloud Run's authentication restrictions prevent Red Teaming from accessing your endpoint, deploy to a simple VM with an open firewall instead.
GCP VM:
5-minute setup:
# 1. Create VM and configure firewall
gcloud compute instances create prisma-airs-streaming-vm \
--project=YOUR-PROJECT-ID \
--zone=us-central1-a \
--machine-type=e2-micro \
--image-family=debian-12 \
--image-project=debian-cloud \
--boot-disk-size=10GB \
--tags=http-server,https-server
# 2. Open firewall for port 5000
gcloud compute firewall-rules create allow-prisma-airs-app \
--project=YOUR-PROJECT-ID \
--allow=tcp:5000 \
--source-ranges=0.0.0.0/0 \
--target-tags=http-server,https-server
# 3. Copy app files and deploy
# (See GCP_VM_DEPLOYMENT.md for complete steps)Returns a public HTTP endpoint (e.g., http://34.59.8.94:5000) for Red Teaming.
When to use this:
- Cloud Run requires authentication your org won't disable
- You need a publicly accessible endpoint for Red Teaming
- You want a simple VM-based deployment
See GCP_VM_DEPLOYMENT.md for complete deployment guide.
π° Cost: Free tier eligible (e2-micro in select regions). Otherwise ~$7/month if left running 24/7.
Azure VM:
# Create VM, open firewall, deploy app
# See AZURE_VM_DEPLOYMENT.md for complete stepsReturns a public HTTP endpoint for Red Teaming.
See AZURE_VM_DEPLOYMENT.md for complete deployment guide.
π° Cost: ~$8/month (Standard_B1s) if left running 24/7.
AWS EC2:
# Launch instance, configure security group, deploy app
# See AWS_VM_DEPLOYMENT.md for complete stepsReturns a public HTTP endpoint for Red Teaming.
See AWS_VM_DEPLOYMENT.md for complete deployment guide.
π° Cost: Free tier eligible (t3.micro for first 12 months). Otherwise ~$8/month if left running 24/7.
1. Install Dependencies
./setup.shThis creates a Python virtual environment and installs required packages.
2. Configure Credentials
export PANW_AI_SEC_API_KEY="your-runtime-security-api-key"
export PRISMA_AIRS_PROFILE="your-security-profile-name"Or create .env file:
cp .env.example .env
# Edit .env with your credentialsGet Your Credentials:
- Log into Strata Cloud Manager
- Navigate to: Settings β Prisma AIRS β Runtime Security
- Copy your API Key and Security Profile name
3. Start Test Application
./start_test_app.sh4. Expose with ngrok (in new terminal):
ngrok http 5000Copy the HTTPS URL shown.
Why this works: Red Teaming's cURL import parser works best with:
- Single-line JSON (no line breaks)
- Minimal headers (just Content-Type)
- Standard short flags (-X, -H, -d)
Copy this exact format:
curl -X POST https://YOUR-NGROK-URL.ngrok-free.dev/v1/chat/completions -H "Content-Type: application/json" -d '{"messages":[{"role":"user","content":"{INPUT}"}],"model":"gpt-3.5-turbo"}'To configure in Red Teaming:
- Log into Strata Cloud Manager
- Navigate to: Insights β Prisma AIRS β Red Teaming β Targets
- Click + New Target
- Choose Import from cURL
- Paste the cURL command above (with your actual ngrok URL)
- Click Import
Done! The parser automatically extracts:
- Endpoint URL
- Headers
- Request body format
- Response structure
If you prefer manual configuration:
Configure Target:
- Name: Runtime Security Test
- Type: Application
- Connection Method: REST API
- API Endpoint:
https://YOUR-NGROK-URL.ngrok-free.app/v1/chat/completions
Request JSON (compact format required):
{"messages":[{"role":"user","content":"{INPUT}"}],"model":"gpt-3.5-turbo"}Response JSON Path:
{"choices":[{"message":{"content":"{RESPONSE}"}}]}- Navigate to: Red Teaming β Scans
- Click + New Scan
- Select your target
- Scan Type: Attack Library
- Select attack categories:
- Prompt Injection
- Jailbreak
- System Prompt Leak
- Violent Crimes/Weapons
- OWASP Top 10 for LLMs
- Click Start Scan
Watch your terminal running the test app:
π¨ Received prompt: Ignore all previous instructions...
π Scan result: malicious / block
β οΈ Detected threats: injection
π« BLOCKED - Returning security error
Check Red Teaming report:
- Risk Score 0-20: Runtime Security working well β
- Risk Score 50-100: Security gaps, tune configuration
β οΈ
Runtime Security Capabilities:
- β Prompt injection detection
- β Jailbreak prevention
- β Data loss prevention (DLP)
- β Malicious URL filtering
- β Toxic content blocking
- β Response scanning for data leakage
Red Teaming Attacks:
- Prompt injection attempts
- Jailbreak techniques
- System prompt extraction
- Sensitive data exfiltration
- Harmful content generation
- Code injection
| Risk Score | Runtime Security Status | Action Required |
|---|---|---|
| 0-10 | Excellent | Maintain configuration |
| 11-30 | Good with minor gaps | Fine-tune specific rules |
| 31-60 | Moderate vulnerabilities | Review security profile |
| 61-80 | Significant exposure | Immediate config review |
| 81-100 | Critical gaps | Verify Runtime Security is active |
Well-Configured Runtime Security:
- Most basic attacks: BLOCKED
- Only sophisticated attacks succeed
- Low false positive rate on benign prompts
Weak Configuration:
- Many attacks: SUCCESSFUL
- Basic jailbreaks work
- High risk score
Check Python environment:
source .venv/bin/activate
python --version # Should be Python 3.8+Verify credentials set:
echo $PANW_AI_SEC_API_KEY
echo $PRISMA_AIRS_PROFILEVerify ngrok is running:
curl https://YOUR-NGROK-URL.ngrok-free.app/healthCheck ngrok hasn't expired:
- Free ngrok URLs expire when you restart
- Copy the new URL and update Red Teaming target
Good, but verify not too restrictive:
curl -X POST https://YOUR-NGROK-URL.ngrok-free.app/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello, how are you?"}]}'Should return a normal response, not blocked.
Check Runtime Security is active:
- Verify API key is correct
- Check security profile exists in SCM
- Ensure profile has detections enabled
- Review app logs for API errors
team-shared-setup/
βββ README.md # This file
βββ LICENSE # MIT License
β
βββ Core Applications
βββ runtime_test_app_direct_api.py # Direct API integration (no SDK)
βββ runtime_test_app_streaming.py # Streaming support (4 formats)
βββ runtime_test_app_streaming_cloudrun.py # Cloud Run optimized version
βββ runtime_test_app.py # Original test app
β
βββ Docker Setup
βββ Dockerfile # Local development container (with ngrok)
βββ Dockerfile.simple # Simple container (no ngrok)
βββ Dockerfile.cloudrun # Cloud Run container
βββ docker-compose.yml # Docker Compose config (with ngrok)
βββ docker-compose.simple.yml # Simple compose (no ngrok)
βββ docker-quickstart.sh # One-command Docker start (with ngrok)
βββ docker-simple-start.sh # Simple Docker start (no ngrok)
βββ start-docker.sh # Container startup script
βββ .dockerignore # Docker build exclusions
β
βββ Cloud Deployment
βββ deploy-to-cloudrun.sh # GCP deployment script
βββ .env.cloudrun.example # Cloud Run environment template
β
βββ Manual Setup Scripts
βββ setup.sh # Python virtualenv setup
βββ start_test_app.sh # Start application
β
βββ Documentation
βββ DOCKER_README.md # Complete Docker guide (with ngrok)
βββ DOCKER_SIMPLE.md # Simple Docker guide (no ngrok)
βββ CLOUDRUN_DEPLOYMENT.md # Full Cloud Run guide
βββ CLOUDRUN_QUICKSTART.md # 5-minute Cloud Run setup
βββ GCP_VM_DEPLOYMENT.md # GCP VM deployment
βββ AZURE_VM_DEPLOYMENT.md # Azure VM deployment
βββ AWS_VM_DEPLOYMENT.md # AWS EC2 deployment
β
βββ Configuration
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore rules
By default, blocked requests return HTTP 200 OK for Red Teaming compatibility. You can configure the status code:
# Keep default 200 OK (recommended for Red Teaming)
export BLOCK_STATUS_CODE=200
./start_test_app.sh
# Use 403 Forbidden (better for production monitoring)
export BLOCK_STATUS_CODE=403
./start_test_app.sh
# Use 451 Unavailable For Legal Reasons (semantic correctness)
export BLOCK_STATUS_CODE=451
./start_test_app.shWhen to use each:
| Status Code | Use Case | Why |
|---|---|---|
| 200 OK (default) | Red Teaming testing | Red Teaming parsers expect 200 responses |
| 403 Forbidden | Production deployments | API clients can detect blocks programmatically |
| 451 Unavailable For Legal Reasons | Policy enforcement | Semantically correct for content blocking |
Impact on Red Teaming:
- 200 OK: Attacks are properly scored in results
- 403/451: May show as "API errors" instead of tracked attacks
By default, the app returns mock responses. To use a real LLM:
export OPENAI_API_KEY="your-openai-key"
./start_test_app.shThen uncomment the OpenAI integration in runtime_test_app.py lines 84-85.
Test different security postures:
# Strict mode
export PRISMA_AIRS_PROFILE="strict-security"
./start_test_app.sh
# Run Red Team scan
# Compare Risk Score
# Balanced mode
export PRISMA_AIRS_PROFILE="balanced-security"
./start_test_app.sh
# Run Red Team scan again
# Compare resultsngrok provides a web interface to see all requests:
# While ngrok is running, open:
open http://localhost:4040Shows every request Red Teaming sends with full details.
- Your test app is publicly accessible while ngrok runs
- Anyone with the ngrok URL can send requests
- DO NOT use production API keys for testing
- DO NOT leave ngrok running when not testing
- Use test/sandbox credentials only
For production testing:
- Deploy to cloud with proper authentication
- Use IP whitelisting
- Implement rate limiting
- Use short-lived credentials
Documentation:
- Runtime Security API Reference
- Red Teaming Documentation
- DOCKER_README.md - Complete Docker setup guide (with ngrok)
- DOCKER_SIMPLE.md - Simple Docker guide (no ngrok, for local/VM)
- CLOUDRUN_DEPLOYMENT.md - Full Cloud Run deployment
- CLOUDRUN_QUICKSTART.md - 5-minute Cloud Run setup
- GCP_VM_DEPLOYMENT.md - GCP VM deployment
- AZURE_VM_DEPLOYMENT.md - Azure VM deployment
- AWS_VM_DEPLOYMENT.md - AWS EC2 deployment
Need Help?
- Review documentation files above
- Contact your Prisma AIRS support team
- Open an issue on GitHub
- Baseline Testing: Run initial scan to establish baseline risk score
- Tune Security: Adjust Runtime Security profile based on findings
- Re-test: Run scan again to measure improvement
- Automate: Schedule weekly scans to monitor defense effectiveness
- Track Trends: Monitor risk score changes over time
Goal: Achieve Risk Score < 20 with minimal false positives on legitimate prompts.
Summary: This package validates that Prisma AIRS Runtime Security effectively protects your AI applications against real-world attacks simulated by AI Red Teaming.
This project is licensed under the MIT License - see LICENSE file for details.
Created by: Scott Thornton Built for: Prisma AIRS AI Security Platform by Palo Alto Networks Β© 2025 Scott Thornton | Licensed under MIT
Scott Thornton β AI Security Researcher
- Website: perfecxion.ai
- Email: scott@perfecxion.ai
- LinkedIn: linkedin.com/in/scthornton
- ORCID: 0009-0008-0491-0032
- GitHub: @scthornton
Security Issues: Please report via SECURITY.md