picoclaw/pkg/config
Andy Lo-A-Foe 5b4f3d575a
fix(mcp): add allowlist and validation for dynamic headers
Addresses security concerns raised in PR review:

1. Dynamic headers now require explicit allowlist per server:
   - New `dynamic_headers.allowed` config field lists permitted header names
   - Without allowlist, no dynamic headers are forwarded (secure by default)
   - Header names matched case-insensitively

2. Add limits to prevent abuse:
   - `max_count`: max headers per request (default: 10)
   - `max_value_len`: max value length (default: 4096)

3. Protect internal metadata in pico channel:
   - Reserved keys (platform, session_id, conn_id, etc.) cannot be
     overwritten by client-provided metadata

Example config:
```json
"dynamic_headers": {
  "allowed": ["X-Grafana-Service-Account-Token"],
  "max_count": 5,
  "max_value_len": 2048
}
```

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-11 09:55:38 +02:00
..
config.go fix(mcp): add allowlist and validation for dynamic headers 2026-05-11 09:55:38 +02:00
config_channel.go add MQTT channel support 2026-04-29 18:27:33 +08:00
config_channel_test.go refactor(config): make config.Channel to multiple instance support 2026-04-13 22:21:21 +08:00
config_old.go refactor(config): make config.Channel to multiple instance support 2026-04-13 22:21:21 +08:00
config_struct.go feat(web): support list editing for channel array fields (#2595) 2026-04-21 16:04:28 +08:00
config_struct_test.go refactor skills registries and add GitHub-backed skill discovery (#2442) 2026-04-14 15:14:16 +08:00
config_test.go Merge upstream/main into feat/agent-discovery-prompt 2026-05-07 13:16:30 +02:00
defaults.go Merge pull request #2677 from alexhoshina/feat/runtime-events-plan 2026-05-03 23:15:25 +02:00
diagnostics.go fix(config): show precise malformed config diagnostics (#2415) 2026-04-27 09:45:52 +08:00
envkeys.go feat(host): complete launcher and gateway multi-host binding support 2026-04-14 14:04:36 +08:00
events.go feat(events): add configurable runtime event logging 2026-04-26 17:41:00 +08:00
events_test.go feat(events): add configurable runtime event logging 2026-04-26 17:41:00 +08:00
example_security_usage.go Merge branch 'main' into fix-doc 2026-03-25 11:13:17 +08:00
gateway.go feat(host): complete launcher and gateway multi-host binding support 2026-04-14 14:04:36 +08:00
gateway_host_env_test.go feat(host): complete launcher and gateway multi-host binding support 2026-04-14 14:04:36 +08:00
legacy_bindings.go fix(session): restore thread and legacy compatibility 2026-04-08 00:32:53 +08:00
migration.go fix(config): show precise malformed config diagnostics (#2415) 2026-04-27 09:45:52 +08:00
migration_integration_test.go refactor skills registries and add GitHub-backed skill discovery (#2442) 2026-04-14 15:14:16 +08:00
migration_test.go refactor(config): make config.Channel to multiple instance support 2026-04-13 22:21:21 +08:00
model_config_test.go feat(tool): tool schema semplification 2026-04-27 21:10:30 +02:00
multikey_test.go feat(tool): tool schema semplification 2026-04-27 21:10:30 +02:00
security.go fix(config): show precise malformed config diagnostics (#2415) 2026-04-27 09:45:52 +08:00
security_integration_test.go fix(config): show precise malformed config diagnostics (#2415) 2026-04-27 09:45:52 +08:00
security_test.go refactor(config): make config.Channel to multiple instance support 2026-04-13 22:21:21 +08:00
version.go feat:Modify the location where version is obtained, and insert version information into the context (#1300) 2026-03-10 17:42:05 +08:00
version_test.go feat:Modify the location where version is obtained, and insert version information into the context (#1300) 2026-03-10 17:42:05 +08:00