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: add field-level redaction for sensitive resource values
Add a redacted_resources configuration section that allows AI agents to
see Kubernetes resource metadata while having sensitive field values
replaced with opaque or HMAC-hashed placeholders.
Redaction is applied in the kubernetes wrapper layer (Core struct) so
that all tool handlers benefit automatically. An exported
RedactResource/RedactResourceList helper is available for toolsets
that bypass the wrapper.
Configuration uses a separate [[redacted_resources]] TOML section with
fields and mode parameters, cleanly separated from denied_resources.
Signed-off-by: Yury Sokov <me@yurzs.dev>
Copy file name to clipboardExpand all lines: docs/configuration.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -410,6 +410,68 @@ version = "v1"
410
410
kind = "ClusterRoleBinding"
411
411
```
412
412
413
+
### Redacted Resources
414
+
415
+
Instead of fully denying a resource, you can allow access but redact sensitive fields. This is useful for resources like Secrets where the agent needs to see metadata (name, namespace, keys, type, ownership) but should not see actual values.
416
+
417
+
| Field | Type | Default | Description |
418
+
|-------|------|---------|-------------|
419
+
| `redacted_resources` | array | `[]` | List of resources with field-level redaction. |
420
+
421
+
Each entry in `redacted_resources` supports the following fields:
422
+
423
+
| Field | Type | Default | Description |
424
+
|-------|------|---------|-------------|
425
+
| `group` | string | required | API group (e.g. `""` for core, `"apps"` for apps/v1) |
426
+
| `version` | string | required | API version (e.g. `"v1"`) |
| `fields` | array | required | Dot-separated field paths to redact |
429
+
| `mode` | string | `"opaque"` | How to redact values: `"opaque"`or `"hashed"` |
430
+
431
+
**Example — redact Secret values while keeping metadata and key names visible:**
432
+
```toml
433
+
[[redacted_resources]]
434
+
group = ""
435
+
version = "v1"
436
+
kind = "Secret"
437
+
fields = ["data.*", "stringData.*"]
438
+
mode = "hashed"
439
+
```
440
+
441
+
**Path syntax:**
442
+
443
+
Fields are specified as dot-separated paths with `*` wildcard support. The wildcard adapts to the type it encounters — it iterates keys in a map and items in an array.
444
+
445
+
| Path | Behavior |
446
+
|------|----------|
447
+
| `data.*` | Redact all values in a map (keys remain visible) |
448
+
| `spec.credentials` | Redact a single field |
449
+
| `spec.template.spec.containers.*.env.*.value` | Traverse arrays and maps to reach nested fields |
450
+
451
+
**Redaction modes:**
452
+
453
+
- `opaque` (default): replaces values with `[REDACTED]`
454
+
- `hashed`: replaces values with `[REDACTED:gen_<id>:<hash>]`
455
+
456
+
Hashed mode uses HMAC-SHA256 with a random salt generated once at server startup. This allows the agent to detect when two different resources reference the same value (e.g. two services using the same connection string) without exposing the actual content. The salt is never persisted and changes on restart. A generation ID is included so consumers can detect when the salt changed and know that hashes from different generations are not comparable.
0 commit comments