Skip to content

Comments

feat(plugins): add Zscaler AI Guard plugin#1514

Open
z-anvesha wants to merge 4 commits intoPortkey-AI:mainfrom
z-anvesha:feature/zscaler-portkey-plugin
Open

feat(plugins): add Zscaler AI Guard plugin#1514
z-anvesha wants to merge 4 commits intoPortkey-AI:mainfrom
z-anvesha:feature/zscaler-portkey-plugin

Conversation

@z-anvesha
Copy link

This commit introduces a new guardrail plugin for Zscaler AI Guard. This plugin allows the Portkey Gateway to perform security checks on prompts and LLM responses using Zscaler's Detections Policy.

Key changes include:

A new plugin handler in plugins/zscaler/main-function.ts that calls the Zscaler execute-policy API.
The handler supports both beforeRequestHook and afterRequestHook to scan inbound prompts and outbound responses.
It checks for BLOCK actions from the Zscaler API and individual detectors, returning a failed verdict if content is blocked.
Integration tests have been added in plugins/zscaler/test-file.test.ts to verify the plugin's functionality against the real Zscaler API for both safe and malicious prompts.
The plugin is defined in plugins/zscaler/manifest.json and registered in the main plugin index.
This new plugin enhances the gateway's security capabilities by integrating with Zscaler's advanced threat and data protection.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new Zscaler AI Guard plugin to the Portkey Gateway, enabling security checks on prompts and LLM responses using Zscaler's Detections Policy API. The plugin acts as a guardrail that can intercept both inbound (prompts) and outbound (responses) content, blocking requests when Zscaler's policy detects threats like prompt injections or data leakage.

Changes:

  • New Zscaler AI Guard plugin with support for both beforeRequestHook and afterRequestHook execution
  • Enhanced build system to handle hyphenated plugin IDs and function names
  • Integration tests for the plugin (safe and malicious prompt scenarios)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
plugins/zscaler/main-function.ts Core plugin handler that calls Zscaler's execute-policy API, processes BLOCK/ALLOW actions, and handles errors
plugins/zscaler/manifest.json Plugin manifest defining credentials (API key), parameters (policy ID), and supported hooks
plugins/zscaler/test-file.test.ts Integration tests verifying plugin behavior with real Zscaler API for safe and malicious prompts
plugins/build.ts Updated build script to support hyphenated plugin IDs by sanitizing identifiers
conf.json Registered the new zscaler plugin in the enabled plugins list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Addressed PR review comments
Address PR comments
Address PR comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant