Skip to content

UmerTariq1/Prompt-Injection-Vulnerability-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ Prompt Injection Vulnerability Demo

A simple hobby project demonstrating prompt injection vulnerabilities in AI applications.

Live Demo

What it does

This project is for the demo purposes. Below are the screenshots

Use Case 1: Financial Analysis

Financial Analysis Demo AI tricked into writing fake news instead of analyzing data

Use Case 2: Resume Review

Resume Review Demo AI manipulated through hidden text in PDF uploads

🚀 Quick Start

Option 1: GitHub Pages (No setup needed)

Just visit the live demo link above - works instantly with mock responses!

Option 2: Local with Mock Backend

git clone https://github.com/UmerTariq1/Prompt-Injection-Demo.git
cd Prompt-Injection-Demo
python -m http.server 8080
# Visit: http://localhost:8080/

Option 3: Local with Real OpenAI API

# create and activate env : 
python -m venv .env
.env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Add your OpenAI API key
echo 'OPENAI_API_KEY="your-key-here"' > .env

# Set USE_MOCK_BACKEND = false in Frontend/script.js and Frontend/script2.js

# Start backend
python backend/main.py

# Visit: Frontend/index.html

📁 Project Structure

├── index.html              # Main landing page
├── Frontend/               # Demo pages
│   ├── index.html         # Financial analysis demo
│   ├── index2.html        # Resume review demo  
│   ├── script.js          # Financial demo logic
│   └── script2.js         # Resume demo logic
├── js/mock-backend.js     # Mock AI responses
├── backend/main.py        # Real Python backend (optional)
└── requirements.txt       # Python dependencies

⚙️ Configuration

To switch between mock and real API:

  • Open Frontend/script.js and Frontend/script2.js
  • Change USE_MOCK_BACKEND = true to false for real OpenAI API
  • Change USE_MOCK_BACKEND = false to true for mock responses

Note : Sample resumes are added in the "data/images/Sample Resumes" folder. Educational Purpose: This is a hobby project to demonstrate AI security vulnerabilities. Always implement proper security measures in production!