Skip to content

bug: TLS-bridge session API still binds all interfaces by default, and config redaction misses non-string secrets #1564

Closed

Description

@huang195

Problem

Two endpoints that need no auth can show what they are meant to hide. Line numbers are at ab5f01f26.

1. With the TLS bridge on, the session API still binds every interface

core/config/config.go:1117-1126 rewrites SessionAPIAddr to 127.0.0.1 when tls_bridge.mode: enabled, because the session API then carries decrypted bodies. But forceLocalhost("") returns "", and the :9094 default is only filled in later by ApplyPreset (presets.go:42).

  • Case: roles: [forward] plus tls_bridge: {mode: enabled}, with no session_api_addr. After Load, ApplyPreset and Validate, the result is SessionAPIAddr=":9094" on all interfaces, so other pods can read decrypted LLM traffic. This was reproduced.
  • demos/context-guru/context-guru-tls-bridge.yaml uses exactly this shape.
  • presets.go:47-51 already describes the same ordering trap for bind_loopback_only.
  • The existing test (config_test.go:975) only covers an address that is set explicitly.

Fix: move the rule into ApplyPreset, after the defaults are set, next to the BindLoopbackOnly block. Add a test with no address set.

2. redact.JSON misses secrets that are not plain strings, and plural key names

core/redact/redact.go:12-44 has two gaps. It redacts only string values, and only when the key ends with secret/password/token/bearer/key/credential (isSensitiveKey, :65-71), so plural keys never match. When this was run on sample payloads, all of these came out in clear text:

  • static-inject "mappings": {"api.openai.com": "sk-live-123"} (core/plugins/staticinject/plugin.go:47)
  • "credentials": "c" (plural key)
  • "api_keys": ["k1"] (plural key, array value)

These come out on /config (stats server, which listens on all interfaces at :9093 by default, config.go:1076-1079) and on /v1/pipeline (:9094). One mitigation: mappings is documented as dev-only.

Fix: redact any value type under a sensitive key, match plurals (credentials, keys, tokens), and add mappings to the list. Add a table test with object, array and plural-key cases.

Found by a code audit of main at ab5f01f.

Assisted-By: Claude (Anthropic AI) [email protected]

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions