You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(guardrails): Add content masking and streaming support to PANW Prisma AIRS guardrail (#15666)
* feat(guardrails): Add content masking and streaming support to PANW Prisma AIRS
- Add mask_request_content and mask_response_content parameters
- Implement content masking for prompts and responses
- Add streaming support with real-time masking
- Add comprehensive test coverage (28 tests)
- Update documentation with masking examples and security notes
* fix(guardrails): Fix PANW Prisma AIRS env var fallback and text completion support
PANW Prisma AIRS can automatically mask sensitive content (PII, credit cards, SSNs, etc.) instead of blocking requests. This allows your application to continue functioning while protecting sensitive data.
241
+
242
+
#### How It Works
243
+
244
+
1. **Detection**: PANW scans content and identifies sensitive data
245
+
2. **Masking**: Sensitive data is replaced with placeholders (e.g., `XXXXXXXXXX` or `{PHONE}`)
246
+
3. **Pass-through**: Masked content is sent to the LLM or returned to the user
247
+
248
+
#### Configuration Options
249
+
250
+
```yaml
251
+
guardrails:
252
+
- guardrail_name: "panw-with-masking"
253
+
litellm_params:
254
+
guardrail: panw_prisma_airs
255
+
mode: "post_call" # Scan both input and output
256
+
api_key: os.environ/PANW_PRISMA_AIRS_API_KEY
257
+
profile_name: "default"
258
+
mask_request_content: true # Mask sensitive data in prompts
259
+
mask_response_content: true # Mask sensitive data in responses
260
+
```
261
+
262
+
**Masking Parameters:**
263
+
264
+
- `mask_request_content: true` - When PANW detects sensitive data in prompts, mask it instead of blocking
265
+
- `mask_response_content: true` - When PANW detects sensitive data in responses, mask it instead of blocking
266
+
- `mask_on_block: true` - Backwards compatible flag that enables both request and response masking
267
+
268
+
:::warning Important: Masking is Controlled by PANW Security Profile
269
+
The **actual masking behavior** (what content gets masked and how) is controlled by your **PANW Prisma AIRS security profile** configured in Strata Cloud Manager. The LiteLLM config settings (`mask_request_content`, `mask_response_content`) only control whether to:
270
+
- **Apply the masked content** returned by PANW and allow the request to continue, OR
271
+
- **Block the request** entirely when sensitive data is detected
272
+
273
+
LiteLLM does not alter or configure your PANW security profile. To change what content gets masked, update your profile settings in Strata Cloud Manager.
274
+
:::
275
+
276
+
:::info Security Posture
277
+
The guardrail is **fail-closed** by default - if the PANW API is unavailable, requests are blocked to ensure no unscanned content reaches your LLM. This provides maximum security.
278
+
:::
279
+
280
+
#### Example: Masking Credit Card Numbers
281
+
282
+
<Tabs>
283
+
<TabItem label="Without Masking" value="no-mask">
284
+
285
+
**Request:**
286
+
```json
287
+
{
288
+
"messages": [
289
+
{"role": "user", "content": "My credit card is 4929-3813-3266-4295"}
290
+
]
291
+
}
292
+
```
293
+
294
+
**Response:** ❌ **Blocked with 400 error**
295
+
296
+
</TabItem>
297
+
<TabItem label="With Masking" value="with-mask">
298
+
299
+
**Request:**
300
+
```json
301
+
{
302
+
"messages": [
303
+
{"role": "user", "content": "My credit card is 4929-3813-3266-4295"}
304
+
]
305
+
}
306
+
```
307
+
308
+
**Masked prompt sent to LLM:**
309
+
```json
310
+
{
311
+
"messages": [
312
+
{"role": "user", "content": "My credit card is XXXXXXXXXXXXXXXXXX"}
313
+
]
314
+
}
315
+
```
316
+
317
+
**Response:** ✅ **Allowed with masked content**
318
+
319
+
</TabItem>
320
+
</Tabs>
321
+
322
+
#### Masking Capabilities
323
+
324
+
The guardrail masks sensitive content in:
325
+
326
+
- ✅ **Chat messages** - User prompts and assistant responses
327
+
- ✅ **Streaming responses** - Real-time masking of streamed content
328
+
- ✅ **Multi-choice responses** - All choices in the response
329
+
- ✅ **Tool/function calls** - Arguments passed to tools and functions
From [official Prisma AIRS documentation](https://docs.paloaltonetworks.com/ai-runtime-security/activation-and-onboarding/ai-runtime-security-api-intercept-overview):
@@ -245,7 +356,7 @@ From [official Prisma AIRS documentation](https://docs.paloaltonetworks.com/ai-r
245
356
## Next Steps
246
357
247
358
- Configure your security policies in [Strata Cloud Manager](https://apps.paloaltonetworks.com/)
248
-
- Review the [Prisma AIRS API documentation](https://pan.dev/prisma-airs/api/airuntimesecurity/scan-sync-request/) for advanced features
359
+
- Review the [Prisma AIRS API documentation](https://pan.dev/airs/) for advanced features
249
360
- Set up monitoring and alerting for threat detections in your PANW dashboard
250
361
- Consider implementing both pre_call and post_call guardrails for comprehensive protection
251
362
- Monitor detection events and tune your security profiles based on your application needs
0 commit comments