Clinical Prompt Injection & Safety Guard
scan_prompt_securityAnalyzes untrusted clinical or user input for prompt injections, jailbreaks, role-play overrides, and guardrail bypasses before LLM processing; returns safe/unsafe status and violations.
Instructions
Analyzes untrusted user inputs, clinical prompts, or external dialogue for adversarial attacks, prompt injections, system jailbreaks, role-play overrides, and clinical guardrail bypass attempts.
When to use:
Sanitizing and vetting untrusted input strings from patients, clinicians, or third-party integrations before processing by downstream LLM reasoning agents.
When NOT to use:
Masking patient identifying data or HIPAA identifiers (use scrub_phi instead).
Clinical emergency triage or medical symptom screening (use check_red_flags instead).
Verifying medical evidence citations or guideline entailment (use verify_evidence instead).
Parameter constraints & formats:
'text': Free-text clinical dialogue, patient consultation prompt, or third-party agent message (up to 50,000 characters). Evaluated across 4 adversarial threat vectors: direct prompt injections ('ignore previous safety rules'), role-play jailbreak personas ('DAN', 'hypothetical unrestricted physician'), system prompt and secret exfiltration ('reveal system instructions'), and lethal dosage overrides (unauthorized dosage escalation, off-label prescription bypasses).
Behavioral guarantees & return states:
Non-LLM deterministic inspection: Pure regex and token analysis running locally in memory without remote classifier APIs, credentials, or rate limits.
Idempotent & non-destructive: Repeated scans on identical text return consistent reports without state mutation.
Threat outcomes: Clean inputs return is_safe=true with violations=[]; detected attacks return is_safe=false with violations listing triggered attack categories. Empty or non-string inputs safely return is_safe=true without exceptions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Untrusted text to evaluate for prompt injections or clinical safety bypasses. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_safe | Yes | True if the text contains zero detected prompt injection or jailbreak patterns; False if threats were flagged. | |
| violations | Yes | List of specific security violation categories detected (e.g. 'PROMPT_INJECTION_DIRECT', 'JAILBREAK_ROLEPLAY'). |