zuplo 7.14.8 → 7.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,13 +15,272 @@ project. The `zuplo.jsonc` file is created by default for new projects and
15
15
  contains the default configuration. For more information on the `zuplo.jsonc`
16
16
  file, see the [Zuplo Project Configuration](./zuplo-json.mdx) documentation.
17
17
 
18
+ ## 2026-11-06
19
+
20
+ :::note
21
+
22
+ This compatibility date is the default for new projects. Existing projects keep
23
+ the date set in their `zuplo.jsonc`. To adopt it in an existing project, set
24
+ `"compatibilityDate": "2026-11-06"` in `zuplo.jsonc`, then test the change in a
25
+ preview environment before you deploy to production. For examples and migration
26
+ steps for each change, see the
27
+ [2026-11-06 changelog entry](https://zuplo.com/changelog/2026/11/06/compatibility-date-2026-11-06).
28
+
29
+ :::
30
+
31
+ This compatibility date makes request validation, the MCP Server handler, and
32
+ the MCP Gateway follow the OpenAPI, JSON Schema, and MCP specifications more
33
+ closely, and adds MCP protocol revision `2026-07-28` support to the MCP Gateway
34
+ and the MCP Server handler. The date turns on every change below together. To
35
+ keep the previous behavior for any of them, keep your project on `2026-03-01` or
36
+ earlier.
37
+
38
+ ### Schema Validation Follows the Declared Specification
39
+
40
+ This compatibility date changes how the
41
+ [Request Validation policy](../policies/request-validation-inbound.mdx) and the
42
+ [MCP Server handler](../handlers/mcp-server.mdx) validate against your OpenAPI
43
+ schemas.
44
+
45
+ **Before this date:** The MCP Server handler converts each tool and prompt
46
+ schema at startup. It inserts `default` values into arguments, drops undeclared
47
+ arguments, and keeps `readOnly` properties in the tool input. A tool whose
48
+ `toolInputStyle` is `flat` but whose input can't be fully flattened stays
49
+ nested, or keeps its request body under a `body` argument, and the MCP server
50
+ logs why. The Request Validation policy can't validate path parameters declared
51
+ on the path item instead of the operation, and fails those requests with
52
+ `Validator not found` when it validates that location.
53
+
54
+ **After this date:** The build generates every tool and prompt schema from your
55
+ OpenAPI document and validates it against the JSON Schema dialect and OpenAPI
56
+ version the document declares. A schema problem, such as an invalid `pattern` or
57
+ a `$ref` that doesn't resolve, fails the build and names the operation. Tools no
58
+ longer insert `default` values, reject undeclared arguments, and leave
59
+ `readOnly` properties out of the input. Patterns use Unicode (`u` flag) regular
60
+ expressions. The Request Validation policy uses the same dialect, `format`, and
61
+ `pattern` rules, keeps its parameter type coercion, and validates path item
62
+ parameters. [Flat tool input](../mcp-server/flat-tool-input.mdx) can also
63
+ flatten some request bodies built from `allOf` and bodies that use
64
+ `dependentRequired`. A tool whose `toolInputStyle` is `flat` but that can't be
65
+ fully flattened, because two input channels declare the same name or its request
66
+ body would stay under `body`, fails the build. The error names the tool, the
67
+ operation, and the cause, and suggests both fixes: change the schema, or set
68
+ `"toolInputStyle": "nested"` on that tool. See
69
+ [When a tool stays nested](../mcp-server/flat-tool-input.mdx#when-a-tool-stays-nested).
70
+
71
+ ### OpenAPI Path Parameters End at the Closing Brace
72
+
73
+ This compatibility date changes how routes match a path parameter that's
74
+ followed by literal text in the same segment, such as `/items/{id}_details`.
75
+
76
+ **Before this date:** Letters, digits, `_`, or `$` after the `}` become part of
77
+ the parameter name. `/x/{id}abc` matches `/x/<anything>` and sets
78
+ `request.params.idabc`, never `request.params.id`. The build warns about each
79
+ such path.
80
+
81
+ **After this date:** The parameter ends at its `}`. `/x/{id}abc` matches
82
+ `/x/fooabc` with `id` set to `foo`, and no longer matches `/x/foo`. Other paths
83
+ match exactly as before.
84
+
85
+ ### Blank Policy Options Are Treated as Unset or Rejected
86
+
87
+ This compatibility date changes how built-in policies handle an empty or
88
+ whitespace-only value, such as `"$env(MY_VAR)"` when `MY_VAR` is empty, for a
89
+ string option.
90
+
91
+ **Before this date:** Many policies reject the empty value for an optional
92
+ option. Some fail every request with a configuration error, for example an empty
93
+ `link` on the HTTP Deprecation policy. Each policy handles an empty required
94
+ option in its own way, so any error that follows doesn't name the option.
95
+
96
+ **After this date:** For an optional option, the policy behaves as if the option
97
+ were left out and applies its default. Secrets, options where an empty value has
98
+ a meaning, and options whose default would grant more access keep their current
99
+ behavior.
100
+
101
+ For a required option, the policy isn't created. Requests to routes that use it
102
+ fail with a configuration error that names each empty required option:
103
+
104
+ ```text
105
+ Policy 'my-oauth-policy': the required option 'clientSecret' is empty. Set it to a value, or check that the environment variable it reads is set.
106
+ ```
107
+
108
+ Required options where an empty value has a meaning keep their current behavior:
109
+ `match` and `replaceWith` on the
110
+ [Replace String policy](../policies/replace-string-outbound.mdx), and `body` on
111
+ the [Set Body policy](../policies/set-body-inbound.mdx). This check applies to
112
+ policies configured in `policies.json`, not to built-in policies that custom
113
+ code creates directly.
114
+
115
+ ### MCP Tool Parameters Use Their OpenAPI Serialization Style
116
+
117
+ This compatibility date changes how the MCP Server handler writes a tool's path,
118
+ query, and header arguments into the request it sends to the route.
119
+
120
+ **Before this date:** The handler ignores `style`, `explode`, `allowReserved`,
121
+ and `content`. Query arrays repeat the parameter name, query objects are sent as
122
+ JSON text, and an object in a path or header becomes `[object Object]`.
123
+
124
+ **After this date:** Each parameter is serialized as its OpenAPI definition
125
+ says. For example, a `deepObject` query parameter becomes
126
+ `rgb[R]=100&rgb[G]=200`, and a `label` path parameter becomes
127
+ `.blue.black.brown`.
128
+
129
+ ### MCP Tool Names Follow the MCP Naming Rule
130
+
131
+ This compatibility date changes the names that the MCP Server handler advertises
132
+ for [tools](../mcp-server/tools.mdx).
133
+
134
+ **Before this date:** Each tool uses its configured name as is, including
135
+ spaces, `/`, and names over 128 characters. When two tools share a name, the
136
+ later one replaces the earlier one.
137
+
138
+ **After this date:** Any character other than `A-Z`, `a-z`, `0-9`, `_`, `-`, and
139
+ `.` becomes `_`, and names are cut to 128 characters. A name that's already
140
+ taken gets a `_2`, `_3`, and so on suffix, so both tools stay available. Clients
141
+ list and call tools by the new name. Names that already follow the rule don't
142
+ change. Set `x-zuplo-route.mcp.name` to choose a stable name.
143
+
144
+ ### MCP Responses Match the Negotiated Protocol Version
145
+
146
+ This compatibility date changes which fields the MCP Server handler sends to
147
+ clients on older MCP protocol versions.
148
+
149
+ **Before this date:** Every response includes every field, so a `2025-03-26`
150
+ client receives `outputSchema`, `structuredContent`, and `title`, which that
151
+ revision doesn't define.
152
+
153
+ **After this date:** The request's `MCP-Protocol-Version` header, or
154
+ `2025-03-26` when it's missing, decides which fields the handler sends. Fields
155
+ added in a later revision are left out. When a `tools/call` result has
156
+ `structuredContent` but no text block, older clients receive its JSON as a text
157
+ block.
158
+
159
+ ### MCP Resource Reads Fail on Error Responses
160
+
161
+ This compatibility date changes how the MCP Server handler answers
162
+ `resources/read` when the [resource](../mcp-server/resources.mdx) route returns
163
+ an error.
164
+
165
+ **Before this date:** The route's response body is returned as the resource's
166
+ contents whatever the status code, so a `403` error body reaches the client as a
167
+ successful read.
168
+
169
+ **After this date:** A status outside `200`-`299` returns a JSON-RPC error
170
+ (`-32603`) that names the resource, its URI, and the status. The route's body
171
+ isn't sent.
172
+
173
+ ### Invalid MCP Resource URIs Fail the Build
174
+
175
+ This compatibility date changes how the build handles a resource URI set in
176
+ `x-zuplo-route.mcp.uri` that isn't an absolute
177
+ [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) URI, such as
178
+ `audit doc with spaces`.
179
+
180
+ **Before this date:** The build warns and the handler advertises the URI as
181
+ written.
182
+
183
+ **After this date:** The build fails and names the operation and the URI. The
184
+ default URI (`mcp://resources/<name>`) is always valid.
185
+
186
+ ### MCP Protocol `2026-07-28` in the MCP Gateway and MCP Server Handler
187
+
188
+ This compatibility date turns on support for MCP protocol revision `2026-07-28`
189
+ in the [MCP Gateway](../mcp-gateway/overview.mdx) and the
190
+ [MCP Server handler](../handlers/mcp-server.mdx#mcp-protocol-2026-07-28).
191
+
192
+ **Before this date:** The MCP Gateway relays `2026-07-28` traffic without
193
+ handling it as that revision. Upstream servers that answer only
194
+ `server/discover` are reported as unavailable. The MCP Server handler answers a
195
+ request with `MCP-Protocol-Version: 2026-07-28` with HTTP `400` and JSON-RPC
196
+ error `-32000`.
197
+
198
+ **After this date:** The MCP Gateway handles `2026-07-28` requests as the
199
+ revision requires, including `server/discover` and `subscriptions/listen`. A
200
+ caller that hasn't connected the upstream gets an `input_required` result with a
201
+ connect link for a tool call, prompt, or resource read, and an empty list for a
202
+ list method. Requests on `2025-11-25` and earlier also get the changes in
203
+ [MCP Gateway Answers Follow the MCP Specification](#mcp-gateway-answers-follow-the-mcp-specification),
204
+ and these project-wide changes:
205
+
206
+ - Upstream readiness checks fall back to `server/discover` when an upstream
207
+ refuses `initialize`.
208
+ - The gateway's OAuth authorization responses include the RFC 9207 `iss`
209
+ parameter.
210
+ - The configured server icons are also added to an `initialize` reply that the
211
+ upstream sends as an event stream.
212
+ - On Managed Edge and in local development, `request.signal` aborts when the
213
+ client disconnects, for all code in the project.
214
+
215
+ The MCP Server handler serves a request whose `MCP-Protocol-Version` header is
216
+ `2026-07-28` on that revision: it answers `server/discover`, returns HTTP `404`
217
+ for the methods `2026-07-28` removed (such as `initialize` and `ping`), adds
218
+ `resultType` and the server's name and version to its results, and adds `ttlMs`
219
+ and `cacheScope` to discovery, list, and read results. A request that names
220
+ `2026-07-28` only in its `params._meta` envelope, without the header, returns
221
+ HTTP `400` with JSON-RPC error `-32020`, because `2026-07-28` requires the
222
+ header. Requests on `2025-11-25` and earlier get the same answers as before,
223
+ apart from the changes in
224
+ [MCP Server Handler Checks Prompt Messages and Batch Answers](#mcp-server-handler-checks-prompt-messages-and-batch-answers).
225
+ The handler doesn't serve tools that ask the client for input (`input_required`
226
+ results, elicitation, sampling, and roots), `subscriptions/listen`
227
+ notifications, logging, or tasks.
228
+
229
+ See
230
+ [MCP Gateway compatibility dates](../mcp-gateway/code-config/compatibility-dates.mdx)
231
+ and
232
+ [MCP protocol `2026-07-28` in the MCP Server handler](../handlers/mcp-server.mdx#mcp-protocol-2026-07-28)
233
+ for details.
234
+
235
+ ### MCP Gateway Answers Follow the MCP Specification
236
+
237
+ This compatibility date changes the answers the
238
+ [MCP Gateway](../mcp-gateway/overview.mdx) builds itself in several error and
239
+ edge cases, mostly for a caller that hasn't connected the upstream yet.
240
+
241
+ **Before this date:** A caller that hasn't connected the upstream gets the
242
+ `-32042` URL-elicitation error with HTTP `200` for every message, including
243
+ notifications, `ping`, malformed bodies, and clients that never declared URL
244
+ elicitation. When the upstream rejects the credential the gateway sent, the
245
+ client gets the upstream's `401` or `403` and its `WWW-Authenticate` challenge.
246
+
247
+ **After this date:** Only an `initialize` on `2025-11-25` that declares URL
248
+ elicitation gets `-32042`. Other requests get JSON-RPC error `-32603` with the
249
+ connect link in `data.connectRequired`. Notifications get HTTP `202` with no
250
+ body, `ping` gets an empty result, malformed bodies and unsupported
251
+ `MCP-Protocol-Version` values get HTTP `400`, and a `GET` or `DELETE` gets HTTP
252
+ `405`. When the upstream rejects the gateway's credential on a route with the
253
+ `mcp-token-exchange-inbound` policy, the client gets JSON-RPC error `-32603`
254
+ with the upstream's status in `data.upstreamStatus`. See
255
+ [Gateway answers follow the MCP specification](../mcp-gateway/code-config/compatibility-dates.mdx#gateway-answers-follow-the-mcp-specification)
256
+ for every change.
257
+
258
+ ### MCP Server Handler Checks Prompt Messages and Batch Answers
259
+
260
+ This compatibility date changes how the
261
+ [MCP Server handler](../handlers/mcp-server.mdx) answers `prompts/get` and
262
+ JSON-RPC batches.
263
+
264
+ **Before this date:** `prompts/get` returns the
265
+ [prompt](../mcp-server/prompts.mdx) route's messages as the route sends them,
266
+ including a `role` such as `system` or a content block MCP doesn't define. A
267
+ batch whose answer holds one response gets a bare object. A tool from the
268
+ deprecated `files` option with a blank `x-zuplo-mcp-tool` name is registered
269
+ with an empty name.
270
+
271
+ **After this date:** `prompts/get` returns JSON-RPC error `-32603` naming the
272
+ prompt and the first invalid message when a message's `role` isn't `user` or
273
+ `assistant`, or its content isn't a block the client's protocol version defines.
274
+ The answer to a batch is always an array. A blank tool name falls back to the
275
+ operation's `operationId`.
276
+
18
277
  ## 2026-03-01
19
278
 
20
279
  :::note
21
280
 
22
- This compatibility date is the default for projects created after March
23
- 1st, 2026. Existing projects should update their `zuplo.jsonc` to take advantage
24
- of this change.
281
+ This compatibility date was the default for projects created after March 1st,
282
+ 2026, until `2026-11-06` became the default. Existing projects should update
283
+ their `zuplo.jsonc` to take advantage of this change.
25
284
 
26
285
  :::
27
286
 
@@ -184,6 +184,9 @@ context.log.info("User login", {
184
184
  });
185
185
  ```
186
186
 
187
+ To redact sensitive values from every log entry, including logs your code
188
+ doesn't control, register a [telemetry redactor](./telemetry-redaction.mdx).
189
+
187
190
  ### 4. Use Structured Data for Better Querying
188
191
 
189
192
  ```ts
@@ -322,6 +322,20 @@ export function runtimeInit(runtime: RuntimeExtensions) {
322
322
  }
323
323
  ```
324
324
 
325
+ ## Telemetry Redaction
326
+
327
+ Use `runtime.addTelemetryRedactor` to remove sensitive data from logs, traces,
328
+ analytics, and audit events before Zuplo records them. See
329
+ [Redact sensitive data from telemetry](./telemetry-redaction.mdx).
330
+
331
+ ```ts
332
+ import { RuntimeExtensions, createRedactor } from "@zuplo/runtime";
333
+
334
+ export function runtimeInit(runtime: RuntimeExtensions) {
335
+ runtime.addTelemetryRedactor(createRedactor({ entities: ["pii", "secret"] }));
336
+ }
337
+ ```
338
+
325
339
  ## Plugin and Handler Extensions
326
340
 
327
341
  Built-in and custom plugins and handlers can expose their own extensibility. For
@@ -0,0 +1,308 @@
1
+ ---
2
+ title: Redact Sensitive Data from Telemetry
3
+ sidebar_label: Telemetry Redaction
4
+ applies_to:
5
+ product: gateway
6
+ hosting: all
7
+ ---
8
+
9
+ Requests that pass through your gateway can carry sensitive data such as card
10
+ numbers, government IDs, and health data. Zuplo records values from each request
11
+ in logs, traces, analytics, and audit events. A telemetry redactor removes
12
+ sensitive data from those values before Zuplo records them.
13
+
14
+ Register a redactor once in `zuplo.runtime.ts`, and every log entry, span,
15
+ analytics record, request logger entry, and audit event passes through it.
16
+ Redaction applies only to what Zuplo records. The request, the response, and the
17
+ values your code reads stay unchanged.
18
+
19
+ ```ts title="modules/zuplo.runtime.ts"
20
+ import { RuntimeExtensions, createRedactor } from "@zuplo/runtime";
21
+
22
+ export function runtimeInit(runtime: RuntimeExtensions) {
23
+ runtime.addTelemetryRedactor(
24
+ createRedactor({
25
+ entities: ["pii", "secret"],
26
+ queryParameters: ["iban"],
27
+ fieldNames: ["dob"],
28
+ }),
29
+ );
30
+ }
31
+ ```
32
+
33
+ With this redactor, a request to `/accounts?iban=DE89370400440532013000&page=2`
34
+ whose handler calls
35
+ `context.log.info("charging", { card: "4111 1111 1111 1111", dob: "1990-01-01" })`
36
+ is recorded like this:
37
+
38
+ ```diff
39
+ - "url": "https://api.example.com/accounts?iban=DE89370400440532013000&page=2"
40
+ + "url": "https://api.example.com/accounts?iban=%5BREDACTED%5D&page=2"
41
+ - "messages": ["charging", { "card": "4111 1111 1111 1111", "dob": "1990-01-01" }]
42
+ + "messages": ["charging", { "card": "[REDACTED]", "dob": "[REDACTED]" }]
43
+ ```
44
+
45
+ The response to the client is the same with or without the redactor.
46
+
47
+ ## Register a redactor
48
+
49
+ Call `runtime.addTelemetryRedactor` inside `runtimeInit` in
50
+ [`zuplo.runtime.ts`](./runtime-extensions.mdx). A redactor is either the result
51
+ of [`createRedactor`](#use-the-built-in-redactor) or your own
52
+ [function](#write-a-custom-redactor).
53
+
54
+ - Register redactors only in `runtimeInit`. Calling `addTelemetryRedactor` after
55
+ the gateway starts, for example inside a request hook, throws an error and
56
+ doesn't add the redactor.
57
+ - You can register up to 16 redactors. Registering a 17th throws an error.
58
+ - Passing anything other than a function throws an error.
59
+
60
+ An error thrown in `runtimeInit` stops the gateway from starting, so a
61
+ misconfigured redactor never lets data through unredacted.
62
+
63
+ ### Combine several redactors
64
+
65
+ Redactors run in the order you register them. Each redactor receives the output
66
+ of the previous one for the same value.
67
+
68
+ ```ts title="modules/zuplo.runtime.ts"
69
+ import { RuntimeExtensions, createRedactor } from "@zuplo/runtime";
70
+
71
+ export function runtimeInit(runtime: RuntimeExtensions) {
72
+ // Runs first: built-in patterns
73
+ runtime.addTelemetryRedactor(
74
+ createRedactor({ entities: ["finance-credit-card", "id-us-ssn"] }),
75
+ );
76
+ // Runs second: receives the output of the first redactor
77
+ runtime.addTelemetryRedactor((value, { key }) =>
78
+ key === "accountNumber" ? "[REDACTED]" : value,
79
+ );
80
+ }
81
+ ```
82
+
83
+ ## Use the built-in redactor
84
+
85
+ `createRedactor(options)` returns a redactor that applies only the options you
86
+ set. It detects sensitive values with the same built-in data types and groups as
87
+ the [Data Loss Prevention policy](../policies/ai-gateway-dlp-inbound.mdx), so
88
+ `entities: ["pii", "secret"]` selects the same data types in both places.
89
+
90
+ | Option | What it redacts |
91
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
92
+ | `entities` | Matches of built-in data types by ID (`finance-credit-card`, `id-us-ssn`), group (`pii`, `secret`, `region-eu`), or ID prefix (`id-us`, `secret-aws`). When omitted, no built-in data type runs. |
93
+ | `customPatterns` | Matches of your own regular expressions. Each entry is `{ name, pattern, confidence?, context? }`. |
94
+ | `minConfidence` | The confidence, from 0 to 1, a match from `entities` or `customPatterns` needs to be redacted. Defaults to `0.5`. |
95
+ | `allowValues` | Matched text that's never redacted, compared exactly, for example a test card number. |
96
+ | `queryParameters` | The value of each named query parameter wherever a query string appears: request URLs, span attributes such as `url.full`, and URLs inside log messages. Names match case-insensitively, after URL decoding. |
97
+ | `fieldNames` | The whole value of any property whose name is in the list, for example `["password", "dob"]`. Names match case-insensitively. |
98
+ | `replacement` | The text recorded in place of a match. It's used literally. Defaults to `[REDACTED]`. In query parameter values, it's URL-encoded, so `[REDACTED]` is recorded as `%5BREDACTED%5D` and the URL stays valid. |
99
+
100
+ `createRedactor` throws an error in `runtimeInit` for an unknown entity, a
101
+ custom pattern that isn't a valid regular expression, or a `minConfidence`
102
+ outside 0 to 1. A typo stops the gateway from starting instead of silently
103
+ turning redaction off.
104
+
105
+ `fieldNames` redacts a value only when it sits directly under the matching
106
+ property name. In `{ dob: "1990-01-01" }` the value is redacted, but in
107
+ `{ dob: ["1990-01-01"] }` or `{ card: { number: "..." } }` the nested values are
108
+ checked only by the other options. Property names themselves are recorded as
109
+ written.
110
+
111
+ ### Custom patterns
112
+
113
+ A custom pattern has a `name`, a regular expression `pattern`, an optional base
114
+ `confidence` (defaults to `0.85`), and optional `context` words. Context words
115
+ that appear near a match in the same value raise its confidence. Use a low
116
+ `confidence` with `context` for values that are sensitive only in context.
117
+
118
+ ```ts title="modules/zuplo.runtime.ts"
119
+ import { RuntimeExtensions, createRedactor } from "@zuplo/runtime";
120
+
121
+ export function runtimeInit(runtime: RuntimeExtensions) {
122
+ runtime.addTelemetryRedactor(
123
+ createRedactor({
124
+ entities: ["pii"],
125
+ customPatterns: [
126
+ // Always redacted: confidence 0.85 is above the 0.5 default
127
+ { name: "member-id", pattern: "MBR-\\d{8}" },
128
+ // Redacted only when "patient" or "mrn" appears nearby
129
+ {
130
+ name: "medical-record-number",
131
+ pattern: "\\b\\d{7}\\b",
132
+ confidence: 0.3,
133
+ context: ["patient", "mrn"],
134
+ },
135
+ ],
136
+ allowValues: ["4111 1111 1111 1111"],
137
+ }),
138
+ );
139
+ }
140
+ ```
141
+
142
+ :::note
143
+
144
+ Pattern matching can't find every form sensitive data takes. Add a
145
+ [custom redactor](#write-a-custom-redactor) for data that's specific to your
146
+ API.
147
+
148
+ :::
149
+
150
+ ## Write a custom redactor
151
+
152
+ A redactor is a synchronous function that takes a string and a context and
153
+ returns the string to record: the input unchanged, or a redacted copy.
154
+
155
+ ```ts
156
+ interface TelemetryRedactor {
157
+ (value: string, context: RedactionContext): string;
158
+ }
159
+
160
+ interface RedactionContext {
161
+ readonly kind: "log" | "span" | "analytics" | "request-log" | "audit-log";
162
+ readonly field: string;
163
+ readonly key: string | undefined;
164
+ }
165
+ ```
166
+
167
+ | Property | Description |
168
+ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
169
+ | `kind` | The kind of record the value is written to. See [What's redacted](#whats-redacted). |
170
+ | `field` | The path of the value in the record, for example `message[0]`, `message[1].user.email`, `properties.customerId`, `attributes.url.full`, or `url`. |
171
+ | `key` | The last property name in `field`, for example `email` or `url.full`. `undefined` when the value isn't an object property, such as a log message string or array element. |
172
+
173
+ For example, `context.log.info("charging", { card: "4111 1111 1111 1111" })`
174
+ calls the redactor twice:
175
+
176
+ | `value` | `kind` | `field` | `key` |
177
+ | ----------------------- | ------ | ----------------- | ----------- |
178
+ | `"charging"` | `log` | `message[0]` | `undefined` |
179
+ | `"4111 1111 1111 1111"` | `log` | `message[1].card` | `card` |
180
+
181
+ The `url.full` attribute on a span is passed with `kind: "span"`,
182
+ `field: "attributes.url.full"`, and `key: "url.full"`.
183
+
184
+ Use the context to apply a rule to one kind of record or one property:
185
+
186
+ ```ts title="modules/zuplo.runtime.ts"
187
+ import { RuntimeExtensions } from "@zuplo/runtime";
188
+
189
+ export function runtimeInit(runtime: RuntimeExtensions) {
190
+ runtime.addTelemetryRedactor((value, { kind, key }) => {
191
+ if (key === "ssn") {
192
+ return "[REDACTED]";
193
+ }
194
+ if (kind === "audit-log" && key === "email") {
195
+ return value.replace(/^[^@]+/, "***");
196
+ }
197
+ return value;
198
+ });
199
+ }
200
+ ```
201
+
202
+ ### How values are passed
203
+
204
+ - Objects, arrays, and errors are walked the way the log serializers write them,
205
+ and each string inside is passed to the redactor separately. For an error,
206
+ that includes its message, stack, cause, and custom properties. A `Map` or
207
+ `Set` is recorded the way the serializers print it, usually `{}`.
208
+ - Numbers are passed as their decimal string. If the redactor returns the same
209
+ string, the record keeps the number. If it returns a different string, the
210
+ record holds that string. Dates work the same way, using their serialized
211
+ string.
212
+ - A span attribute array must hold a single type. If the redactor changes any
213
+ number in such an array, every element is recorded as text.
214
+ - When the redacted request URL given to log transports is no longer a valid
215
+ URL, transports receive the original origin followed by `/[REDACTED]`.
216
+ - In audit events, the IP address is left out of the event when the redactor
217
+ changes it.
218
+
219
+ ### Keep redactors pure and fast
220
+
221
+ A redactor runs on the request path for every value Zuplo records, so keep it
222
+ fast. It must also be pure: the same value and context must always return the
223
+ same output. Zuplo caches results for values of 256 characters or fewer and can
224
+ reuse an earlier result instead of calling the redactor again.
225
+
226
+ Anything a redactor logs is dropped, so a redactor can't write sensitive values
227
+ into the logs it's meant to protect.
228
+
229
+ ## Failures
230
+
231
+ Redaction fails closed. When a redactor throws an error, returns anything other
232
+ than a string, or is `async` (returns a promise), Zuplo records the value as
233
+ `[REDACTION_FAILED]`. Later redactors don't run for that value, and the original
234
+ value is never recorded. The `REDACTION_FAILED_PLACEHOLDER` constant exported
235
+ from `@zuplo/runtime` holds this text.
236
+
237
+ Each failure writes a warning to your gateway's logs, at most once a minute for
238
+ each kind of record:
239
+
240
+ ```txt
241
+ A redactor registered with runtime.addTelemetryRedactor threw or did not return a string while redacting a log record. The value was recorded as [REDACTION_FAILED]. Further failures are reported at most once a minute.
242
+ ```
243
+
244
+ The warning never contains the value or the redactor's error message.
245
+
246
+ ## Limits
247
+
248
+ | Limit | Value |
249
+ | ------------------ | -------------------------------------------------------------------------------------------------------------- |
250
+ | Redactors | 16, registered only in `runtimeInit` |
251
+ | Value length | 32,768 characters. Longer values, and longer redactor output, are cut to that length and marked `[Truncated]`. |
252
+ | Values per record | 10,000, shared by every field of the record. Values past the limit are recorded as `[Truncated]`. |
253
+ | Nesting depth | 20 levels. Deeper values are recorded as `[Truncated]`. |
254
+ | Values that repeat | A value that contains itself is recorded as `[Circular]` where it repeats. |
255
+
256
+ ## What's redacted
257
+
258
+ When a redactor is registered, these values pass through it before any log
259
+ transport, tracing exporter, plugin, or Zuplo service receives the record. Every
260
+ destination receives the same redacted record. With no redactor registered,
261
+ records are unchanged.
262
+
263
+ | `kind` | Record | Values passed to the redactor |
264
+ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
265
+ | `log` | [Logs](./logger.mdx) from Zuplo and from your code | Every message argument, log properties, custom log fields, and the request URL given to log transports |
266
+ | `span` | [OpenTelemetry](../articles/opentelemetry.mdx) spans | The span name, every attribute, every event name and event attribute, every link attribute, and the status message |
267
+ | `analytics` | [Analytics](../analytics/overview.md) request records and events | The request URL (path and query string), properties your code sets with `setLogProperties`, and the resource URI on analytics events |
268
+ | `request-log` | Request logger plugins: [Azure Blob](../articles/plugin-azure-blob.mdx), [Azure Event Hubs](../articles/plugin-azure-event-hubs.mdx), and [Hydrolix](../articles/plugin-hydrolix-traffic-peak.mdx) | Every value of each entry |
269
+ | `audit-log` | Events from the [Audit Logs policy](../policies/audit-log-inbound.mdx) | Every field except the fields listed in the next section |
270
+
271
+ ### Values that aren't redacted
272
+
273
+ Zuplo computes usage, analytics, and billing from some recorded values, and
274
+ generates others itself. These values are always recorded as measured, even when
275
+ a redactor is registered:
276
+
277
+ | Record | Values recorded as measured |
278
+ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
279
+ | Analytics request record | Route pattern, method, status code, sizes, timings, user, client IP, geographic fields, ray ID, request IDs, and properties Zuplo sets |
280
+ | Analytics events | Every field except the resource URI, including the model, provider, app, team, and consumer that AI Gateway usage is metered by |
281
+ | Audit events | `specversion`, `id`, `time`, `datacontenttype`, `bucketid`, `actortype`, `requestid`, `success`, `httpmethod`, and `httpstatus` |
282
+
283
+ Keep sensitive data out of route paths and user identifiers, because a redactor
284
+ can't remove it from these fields.
285
+
286
+ ### Data that redactors don't cover
287
+
288
+ Redactors apply only to records the gateway writes through the paths listed
289
+ earlier. They don't cover:
290
+
291
+ - Data that metering and analytics policies send to their services, such as
292
+ Moesif, ReadMe, Amberflo, and OpenMeter. Those services receive the raw
293
+ values.
294
+ - Request and response bodies sent to Akamai API Security.
295
+ - Output written directly to the console instead of through `context.log`, and
296
+ uncaught errors captured by the hosting platform.
297
+ - Logs written before `runtimeInit` runs.
298
+ - OpenTelemetry resource attributes and other static configuration.
299
+ - Data the gateway stores to serve requests, such as cache entries and rate
300
+ limit keys.
301
+ - Records after they leave the gateway.
302
+
303
+ ## Related
304
+
305
+ - [Runtime extensions](./runtime-extensions.mdx)
306
+ - [Logger](./logger.mdx)
307
+ - [OpenTelemetry](../articles/opentelemetry.mdx)
308
+ - [Data Loss Prevention policy](../policies/ai-gateway-dlp-inbound.mdx)
@@ -19,7 +19,7 @@ of the file is `1`.
19
19
  ```jsonc
20
20
  {
21
21
  "version": 1,
22
- "compatibilityDate": "2025-02-06",
22
+ "compatibilityDate": "2026-11-06",
23
23
  "projectType": "managed-edge",
24
24
  }
25
25
  ```
@@ -46,7 +46,7 @@ and their changes.
46
46
  ```jsonc
47
47
  {
48
48
  "version": 1,
49
- "compatibilityDate": "2025-02-06",
49
+ "compatibilityDate": "2026-11-06",
50
50
  }
51
51
  ```
52
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuplo",
3
- "version": "7.14.8",
3
+ "version": "7.15.1",
4
4
  "type": "module",
5
5
  "description": "The official Zuplo CLI for local development and platform management",
6
6
  "homepage": "https://zuplo.com/docs/cli/overview",
@@ -17,7 +17,7 @@
17
17
  "mcp-gateway"
18
18
  ],
19
19
  "author": "Zuplo, Inc.",
20
- "license": "See LICENSE in LICENSE.txt",
20
+ "license": "SEE LICENSE IN LICENSE.txt",
21
21
  "files": [
22
22
  "README.md",
23
23
  "LICENSE.txt",
@@ -32,9 +32,9 @@
32
32
  "zuplo": "zuplo.js"
33
33
  },
34
34
  "dependencies": {
35
- "@zuplo/cli": "7.14.8",
36
- "@zuplo/core": "7.14.8",
37
- "@zuplo/runtime": "7.14.8",
38
- "@zuplo/test": "7.14.8"
35
+ "@zuplo/cli": "7.15.1",
36
+ "@zuplo/core": "7.15.1",
37
+ "@zuplo/runtime": "7.15.1",
38
+ "@zuplo/test": "7.15.1"
39
39
  }
40
40
  }