Inspiration

As AI applications become more powerful, their security becomes increasingly important. A user prompt is not always just a harmless instruction — attackers can use prompt injection, jailbreaks, system prompt extraction, data exfiltration, obfuscation, and other techniques to manipulate an LLM.

We wanted to build a practical security layer that sits before the LLM, rather than trusting every incoming prompt.

This led us to build PromptShield — AI Security Gateway, a security gateway that analyzes requests, explains potential threats, and controls whether they should be allowed, reviewed, or blocked.

What it does

PromptShield acts as a security boundary between an AI application and its underlying LLM.

A request passes through:

Input Normalization → Rule-Based Detection → Gemini AI Analysis → Risk Correlation → Safety Gate

The Safety Gate produces one of three decisions:

  • ALLOW — safe requests can continue to the LLM
  • REVIEW — suspicious requests can be sent through a human-in-the-loop review path
  • BLOCK — high-risk malicious requests are stopped before reaching the LLM

PromptShield currently detects 12 threat categories, including:

  • Direct Prompt Injection
  • Jailbreak
  • System Prompt Extraction
  • Instruction Override
  • Data Exfiltration
  • Obfuscation
  • Role-Play Jailbreak
  • Multilingual Injection
  • Unicode / Homoglyph Attacks
  • Delimiter Smuggling
  • Tool Abuse
  • Context Manipulation

It also includes an Attack Lab with 19 adversarial security scenarios for repeatable testing.

The controlled security test suite currently achieves 19/19 detections (100%). This is a result for the included test scenarios and is not a claim of complete protection against all real-world attacks.

PromptShield also provides security telemetry for risk scores, decisions, threat categories, AI confidence, latency, and LLM forwarding status. Raw prompts are not stored in telemetry; a prompt hash is used instead.

How we built it

PromptShield was built as a full-stack web application using:

  • Next.js + React
  • TypeScript
  • Tailwind CSS
  • Custom rule-based security analyzer
  • Google Gemini API for semantic security analysis
  • Gemini LLM gateway for approved requests
  • Recharts for security analytics
  • Lucide / shadcn UI for the interface
  • Browser localStorage for privacy-preserving demo telemetry
  • Vercel for deployment

The security engine first normalizes input using techniques such as Unicode normalization and encoding-aware processing. It then performs deterministic pattern and indicator analysis across the threat categories.

Gemini provides a second semantic analysis layer that can identify threats based on meaning and context rather than only matching predefined patterns.

The results are combined by a risk engine before the final safety decision is made.

Challenges we ran into

One of the biggest challenges was avoiding a security system that only detects obvious phrases such as "ignore previous instructions."

Real prompt attacks can be indirect, encoded, multilingual, disguised as system or developer messages, hidden inside documents, or combined with tool and context manipulation.

We therefore expanded the system beyond simple keyword matching by adding normalization, Unicode handling, encoding detection, multiple threat categories, adversarial scenarios, and Gemini-based semantic analysis.

Another challenge was making sure security controls did not prevent legitimate AI usage. The ALLOW / REVIEW / BLOCK model provides a way to balance usability with security.

We also wanted the platform to be demonstrable and measurable, which led to the Attack Lab and live security telemetry.

Accomplishments that we're proud of

  • Built a functional AI security gateway, not just a prompt classifier
  • Integrated Gemini AI as a second semantic security layer
  • Implemented 12 threat categories
  • Created 19 adversarial security scenarios
  • Achieved 19/19 detection on the controlled security test suite
  • Implemented an ALLOW / REVIEW / BLOCK safety gate
  • Added a human-in-the-loop review concept
  • Built a real LLM gateway that only forwards approved requests
  • Added privacy-preserving security telemetry
  • Created a live dashboard for monitoring security activity
  • Deployed the complete application as a publicly accessible web application

Most importantly, PromptShield demonstrates a complete security workflow:

Detect → Explain → Assess Risk → Govern → Control LLM Access

What we learned

We learned that securing LLM applications requires more than detecting suspicious keywords.

Effective AI security needs multiple layers: deterministic rules for predictable threats, semantic analysis for contextual attacks, normalization for obfuscated input, risk correlation, and an enforcement layer that can actually prevent unsafe requests from reaching the model.

We also learned the importance of security evaluation. A security system should be tested against a repeatable adversarial suite rather than relying only on a few manually selected examples.

Building PromptShield also showed us how security, AI, UX, observability, and responsible AI design need to work together.

What's next for PromptShield — AI Security Gateway

The next step is to evolve PromptShield from a prompt security gateway into a broader LLM and AI-agent security platform.

Future improvements include:

  • Real-time protection for AI agents and tool calls
  • More adaptive attack detection
  • Larger adversarial evaluation datasets
  • RAG and document-level injection protection
  • Continuous security monitoring
  • Policy management for production AI applications
  • Enterprise integrations and centralized security telemetry
  • Automated red-team testing for LLM applications

Our goal is to make security a built-in control layer for AI applications rather than an afterthought.

Built With

Share this project:

Updates

Submission history