integration: Add PromptGuard AI security guardrails plugin#1595
Open
acebot712 wants to merge 1 commit intoPortkey-AI:mainfrom
Open
integration: Add PromptGuard AI security guardrails plugin#1595acebot712 wants to merge 1 commit intoPortkey-AI:mainfrom
acebot712 wants to merge 1 commit intoPortkey-AI:mainfrom
Conversation
Add PromptGuard as a guardrails plugin for the Portkey AI Gateway. PromptGuard provides ML-powered security scanning and PII redaction for LLM inputs and outputs. Plugin functions: - scan: Detect prompt injection, jailbreaks, and toxicity - redact: Detect and redact PII (emails, phones, SSNs, etc.) Both functions support beforeRequestHook and afterRequestHook. Includes: - manifest.json with plugin configuration - scan.ts handler for security scanning - redact.ts handler for PII redaction - promptguard.test.ts with 7 unit tests (all passing) - Registration in conf.example.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds PromptGuard as a guardrails plugin for the Portkey AI Gateway. PromptGuard is an ML-powered AI security firewall that provides real-time threat detection and PII protection for LLM traffic.
Plugin functions
beforeRequestHook,afterRequestHookbeforeRequestHook,afterRequestHookFiles added/changed
plugins/promptguard/manifest.json— Plugin manifest with credentials and function definitionsplugins/promptguard/scan.ts— Security scan handler (prompt injection, jailbreak, toxicity detection)plugins/promptguard/redact.ts— PII detection and redaction handler with content transformationplugins/promptguard/promptguard.test.ts— 7 unit tests covering credential validation, empty input, and edge casesconf.example.json— Addedpromptguardtoplugins_enabledCredentials
apiKeybaseUrlhttps://api.promptguard.co/api/v1Configuration example
{ "name": "promptguard-scan", "provider": "promptguard", "credentials": { "apiKey": "pg_live_..." }, "function": "scan", "onSuccess": "allow", "onFail": "deny" }Test plan
npx jest plugins/promptguard/ --no-coverage)prettier --checkpasses (pre-commit hook verified)eslintpasses with zero errorsrollup -cvia pre-push hook)