Security vendor integration guide
Two paths for a security vendor to connect detection into the gateway: the content-safety detector HTTP API and a WASM gateway extension
Security vendor integration guide
A security vendor can connect its detection into the gateway on two paths. Both are already implemented in the product; no custom development is required:
| Content-safety detector HTTP API | WASM gateway extension | |
|---|---|---|
| Vendor deliverable | An HTTP service that implements the platform contract | An extension package (Rust or Lua compiled to WASM) |
| Where it runs | The vendor's own service; the platform calls it | Inside the gateway process, with the request |
| What it can do | Score input and output (including multi-turn history) on 6 risk categories and prompt injection. Allow or block is decided by the traffic rule's Content detection action against thresholds | Allow or reject a request, rewrite request body and headers, incrementally inspect a streaming response. Logic is written by the vendor |
| Time budget | 8 seconds per call | 20 ms per execution, at most 4 controlled HTTP requests |
| Applies to | Model calls | Model calls, MCP services, API services, external agents (as the extension declares) |
| Platform-side configuration | Add a model provider + select it as the default content-safety model + use Content detection in a traffic rule | Upload the extension package + install + bind to a service |
1. How to choose
- Detection depends on model inference or a vendor cloud service, and a single call takes tens of milliseconds or more: choose the HTTP API. The platform calls a fixed contract. Results enter the unified content-detection, trial-judge, and audit path. Thresholds and failure policy are configured by the administrator in a traffic rule.
- Rule-like, locally computable judgments (headers, identity, keywords, format checks, rewrite/redaction, streaming-output truncation), or when it must apply to MCP, API services, or external agents: choose a WASM gateway extension.
- Both can be used together: the extension does lightweight front checks and rewrites; the HTTP API does semantic risk scoring.
2. Path 1: content-safety detector HTTP API
Contract
Full fields are in Custom content-safety detector API. The points:
POST {base_url}/v1/content-safety,Authorization: Bearer <API-key>, JSON request and response.- The request contains
direction(input/output) anduserText. The output direction carriesresponseText. Multi-turn detection on carrieshistory. - The response must give scores for the 6 fixed
categoriesandjailbreak, all 0–1. Optionallabelsare for audit only. A missing key, unknown key, or out-of-range score is an invalid response. - Timeout 8 seconds. Timeout, connection failure, or an invalid response is handled by the rule's On detection failure action; it is not silently allowed.
Go-live steps
- The vendor deploys the detector and confirms the gateway can reach its Base URL (an intranet address must be allowed through platform outbound protection).
- An administrator adds a provider under Model Providers, chooses the preset Custom content-safety detector, and fills in Base URL and API key.
- On the Content safety row under Global settings › Default models, select that service, set Model type to Custom content-safety detector, and save. On save the platform actually calls with one violating sample and one safe sample. A failed check does not save and gives a reason.
- Use the Content detection action in a traffic rule. Choose risk categories, thresholds, and the On detection failure handling.
- Use Try a sentence and Validate rule to send a safe sample and a real business-risk sample separately. Confirm hits match expectations, then enable it for a pilot caller.
3. Path 2: WASM gateway extension
Contract
Full development, build, validate, and publish notes are in Gateway extension development. The points:
- Package contract
zenova.gateway-plugin/v4. The manifest declaressupportedServiceKinds(model,mcp,http_proxy,a2a). - Three interfaces:
request-gate(allow or reject),request-transform(rewrite the request),gateway-response-transform(inspect a streaming response). - Each execution: 2,000,000 instruction budget, 20 ms, 4 MiB memory. External services may be reached only through
http_request; destinations must be declared in the manifest and authorized by the install-time key binding. - On upload the platform compiles with the production host and runs one synthetic request. Failure is refused.
Go-live steps
- The vendor generates a template with Gateway extensions › Download SDK or
zr-plugin init, writes logic, thenzr-plugin buildandzr-plugin validate. - An administrator uploads the extension package under Gateway extensions (or the vendor publishes with
zr-plugin publishusing a user token that has gateway-extension management permission). - On the extension detail Permissions tab, check network targets, keys, and security and PII requirements. When the vendor cloud must be reached, configure key bindings and allowed destinations under Bindings.
- Fill in configuration and install (installed as disabled). After status is In effect, enable it. Under Bindings, choose service type and service scope. Configure a security-critical extension's failure policy as
fail_closed. - Verify with hitting and non-hitting requests separately. Check intercepts, failures, and p95 duration under Execution stats. When duration approaches 20 ms, move heavy computation onto the HTTP-API side.
4. Acceptance checklist
- Safe samples are allowed; risk samples are blocked or rewritten as expected.
- When the detector is down or the extension errors, the request is handled by the configured failure policy, not allowed.
- Observability and audit can see each detection's result and reason.
A2A call linkage and billing by caller
An external A2A agent carries a platform-issued call credential into model calls. The platform uses it to tie the agent's internal model calls to a specific A2A call and bill them to the caller.
Custom content-safety detector API
Request / response format, authentication, and timeout requirements for the content-safety detector service (D7 contract)