Skip to content

Commit 51fe882

Browse files
author
Vish Devarajan
committed
Added new features
1 parent fd5b2d7 commit 51fe882

8 files changed

Lines changed: 499 additions & 8 deletions

File tree

BENCHMARKS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Operational questions this should answer:
3434
- What would have been blocked this week?
3535
- Which routes trigger the most prompt-injection findings?
3636
- Which features or workflows are producing the most noise?
37+
- Which users or identity providers are associated with the most risky traffic?
3738
- Which tenants or models show the highest concentration of severe findings?
3839
- Which rules are most common before enforcement is turned on?
3940
- Did the latest release increase alerts on the same route mix?

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.2.0
4+
5+
- Added `ValueAtRiskCircuitBreaker` for high-value tool/action thresholds with session revocation and MFA-style escalation flags
6+
- Added `ShadowConsensusAuditor` integration in tool gating for logic-conflict review on high-impact actions
7+
- Added `DigitalTwinOrchestrator` for mock tool sandboxes and pre-production twin testing
8+
- Added `suggest_policy_override()` for self-healing policy tuning suggestions after approved false positives
9+
- Added signed agent passports in `AgentIdentityRegistry`
10+
11+
## 0.1.9
12+
13+
- Added enterprise telemetry enrichment with SSO/user attribution on emitted events and audit records
14+
- Added Power BI-friendly record builders and exporter hooks for telemetry pipelines
15+
- Expanded operational summaries to break down findings by user and identity provider
16+
317
## 0.1.8
418

519
- Expanded enterprise rollout guidance for controlled pilots, internal shield wrappers, and false-positive tuning

MIGRATING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Migrating to 0.1.8
1+
# Migrating to 0.1.9
22

33
## Stable Contracts
44

@@ -21,6 +21,12 @@ These contracts are also exposed in `CORE_INTERFACES` so applications can log or
2121
- Added custom prompt detector hooks for domain tuning
2222
- Expanded rollout guidance, benchmarks, and regression notes
2323

24+
## What Changed in 0.1.9
25+
26+
- Added identity-aware telemetry enrichment for SSO-backed applications
27+
- Added Power BI-friendly export helpers and telemetry exporter hooks
28+
- Expanded summaries to support user-level and identity-provider reporting
29+
2430
## What Changed in 0.1.8
2531

2632
- Added explicit guidance for controlled-pilot rollout and internal wrapper adoption

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ The current recommendation for enterprise teams is a controlled pilot first: sta
7777

7878
Use `summarize_operational_telemetry()` with emitted telemetry events when you want route-level, tenant-level, and model-level summaries, blocked-event counts, and rollout visibility for operators.
7979

80+
Enterprise deployments can also enrich emitted events with SSO/user context and forward flattened records to Power BI or other downstream reporting systems.
81+
8082
### Output grounding and tone review
8183

8284
`OutputFirewall` can compare a response to retrieval documents and flag unsupported claims or unprofessional tone before the answer leaves your service.
@@ -105,6 +107,8 @@ Protects the response path by checking outputs for secret leaks, unsafe code pat
105107

106108
Protects tool execution with allowlists, blocklists, validators, and approval-required workflows.
107109

110+
It can also integrate with `ValueAtRiskCircuitBreaker` for high-value actions and `ShadowConsensusAuditor` for secondary logic review before sensitive tools execute.
111+
108112
### `RetrievalSanitizer`
109113

110114
Helps keep hostile or manipulative text in retrieved documents from becoming model instructions.
@@ -170,6 +174,48 @@ def create_model_shield(shield):
170174
return run
171175
```
172176

177+
## Add SSO-aware Telemetry and Power BI Export
178+
179+
```python
180+
from blackwall_llm_shield import BlackwallShield, PowerBIExporter
181+
182+
shield = BlackwallShield(
183+
identity_resolver=lambda metadata: {
184+
"user_id": ((metadata.get("sso") or {}).get("subject")),
185+
"user_email": ((metadata.get("sso") or {}).get("email")),
186+
"user_name": ((metadata.get("sso") or {}).get("displayName")),
187+
"identity_provider": ((metadata.get("sso") or {}).get("provider")),
188+
"groups": ((metadata.get("sso") or {}).get("groups") or []),
189+
},
190+
telemetry_exporters=[
191+
PowerBIExporter(endpoint_url="https://example.powerbi.local/push"),
192+
],
193+
)
194+
```
195+
196+
## Protect High-value Actions with a VaR Breaker and Consensus Auditor
197+
198+
```python
199+
firewall = ToolPermissionFirewall(
200+
allowed_tools=["issue_refund"],
201+
value_at_risk_circuit_breaker=ValueAtRiskCircuitBreaker(max_value_per_window=5000),
202+
consensus_auditor=ShadowConsensusAuditor(),
203+
consensus_required_for=["issue_refund"],
204+
)
205+
```
206+
207+
## Generate a Digital Twin for Sandbox Testing
208+
209+
```python
210+
twin = DigitalTwinOrchestrator(
211+
tool_schemas=[
212+
{"name": "lookup_order", "mock_response": {"order_id": "ord_1", "status": "mocked"}},
213+
]
214+
).generate()
215+
216+
twin["simulate_call"]("lookup_order", {"order_id": "ord_1"})
217+
```
218+
173219
## Strict JSON Workflow Pattern
174220

175221
```python
@@ -288,6 +334,8 @@ shield = BlackwallShield(
288334
summary = summarize_operational_telemetry(events)
289335
print(summary["by_route"])
290336
print(summary["by_feature"])
337+
print(summary["by_user"])
338+
print(summary["by_identity_provider"])
291339
print(summary["noisiest_routes"])
292340
print(summary["weekly_block_estimate"])
293341
print(summary["by_tenant"])
@@ -299,6 +347,14 @@ print(summary["highest_severity"])
299347

300348
Produces signed events you can summarize into operations dashboards or audit pipelines.
301349

350+
## Advanced Agent Controls
351+
352+
- `ValueAtRiskCircuitBreaker` for financial or high-value operational actions
353+
- `ShadowConsensusAuditor` for second-model or secondary-review logic conflict checks
354+
- `DigitalTwinOrchestrator` for mock tool environments and sandbox simulations
355+
- `suggest_policy_override()` for narrow false-positive tuning suggestions after HITL approvals
356+
- `AgentIdentityRegistry.issue_signed_passport()` for signed agent identity exchange
357+
302358
## Included Examples
303359

304360
- [`examples/python-fastapi/main.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/main.py)
@@ -339,6 +395,8 @@ For Gemini-heavy apps, the bundled adapter now preserves system instructions plu
339395
- A controlled pilot is a good fit today when you want shadow-mode prompt and output protection without forcing hard blocking on every route immediately.
340396
- If you prefer not to depend on Blackwall directly everywhere, wrap it behind your own internal model-security abstraction and expose only the contract your app teams need.
341397
- For broader approval, focus rollout reviews on false-positive rates, noisiest routes, and latency budgets alongside jailbreak coverage.
398+
- For executive or staff-facing workflows, always attach authenticated identity metadata so telemetry can answer which user triggered which risky request or output event.
399+
- For high-impact agentic workflows, combine tool approval, VaR limits, digital-twin tests, and signed agent passports instead of relying on a single detector.
342400

343401
## Rollout Notes
344402

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "vpdeva-blackwall-llm-shield-python"
7-
version = "0.1.8"
7+
version = "0.2.0"
88
description = "Open-source Python enterprise LLM protection toolkit for Python services"
99
readme = "README.md"
1010
requires-python = ">=3.9"

src/blackwall_llm_shield/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,27 @@
55
BlackwallFastAPIMiddleware,
66
BlackwallShield,
77
CoTScanner,
8+
DigitalTwinOrchestrator,
89
ImageMetadataScanner,
910
LightweightIntentScorer,
1011
MCPSecurityProxy,
1112
OutputFirewall,
1213
RetrievalSanitizer,
1314
ShadowAIDiscovery,
1415
SessionBuffer,
16+
ShadowConsensusAuditor,
1517
TokenBudgetFirewall,
1618
ToolPermissionFirewall,
19+
ValueAtRiskCircuitBreaker,
1720
VisualInstructionDetector,
1821
SHIELD_PRESETS,
1922
CORE_INTERFACES,
2023
POLICY_PACKS,
2124
build_shield_options,
2225
summarize_operational_telemetry,
2326
build_admin_dashboard_model,
27+
build_enterprise_telemetry_event,
28+
build_powerbi_record,
2429
create_fastapi_guard,
2530
create_langchain_callbacks,
2631
create_flask_middleware,
@@ -39,7 +44,10 @@
3944
mask_text,
4045
mask_value,
4146
normalize_messages,
47+
normalize_identity_metadata,
4248
parse_json_output,
49+
PowerBIExporter,
50+
suggest_policy_override,
4351
run_red_team_suite,
4452
rehydrate_from_bundle,
4553
rehydrate_response,
@@ -72,6 +80,7 @@
7280
"BlackwallShield",
7381
"CoTScanner",
7482
"CORE_INTERFACES",
83+
"DigitalTwinOrchestrator",
7584
"FastTextIntentScorer",
7685
"ImageMetadataScanner",
7786
"LightweightIntentScorer",
@@ -80,15 +89,19 @@
8089
"RetrievalSanitizer",
8190
"ShadowAIDiscovery",
8291
"SessionBuffer",
92+
"ShadowConsensusAuditor",
8393
"TokenBudgetFirewall",
8494
"ToolPermissionFirewall",
95+
"ValueAtRiskCircuitBreaker",
8596
"VisualInstructionDetector",
8697
"POLICY_PACKS",
8798
"ProviderAdapter",
8899
"SHIELD_PRESETS",
89100
"build_shield_options",
90101
"summarize_operational_telemetry",
91102
"build_admin_dashboard_model",
103+
"build_enterprise_telemetry_event",
104+
"build_powerbi_record",
92105
"create_fastapi_guard",
93106
"create_langchain_callbacks",
94107
"create_flask_middleware",
@@ -108,7 +121,10 @@
108121
"mask_text",
109122
"mask_value",
110123
"normalize_messages",
124+
"normalize_identity_metadata",
111125
"parse_json_output",
126+
"PowerBIExporter",
127+
"suggest_policy_override",
112128
"run_red_team_suite",
113129
"rehydrate_from_bundle",
114130
"rehydrate_response",

0 commit comments

Comments
 (0)