feat(client): add extra_headers to AgentConfig and --header to CLI#584
Closed
feat(client): add extra_headers to AgentConfig and --header to CLI#584
Conversation
Adds AgentConfig.extra_headers (dict[str, str] | None) so callers can pass routing and context headers like x-adcp-tenant alongside auth_token. Auth wins on conflict with a logged warning. The --header KEY=VALUE CLI flag (repeatable, -H alias) is persisted via --save-auth and honoured on load. Plumbed through both MCP and A2A adapters. Closes #583 https://claude.ai/code/session_01PACTmRta6eyqmZkaAwBpnF
…arse time Both blockers from pre-PR review: extend CRLF guard to cover \x00 (matching webhooks._HEADER_FORBIDDEN_CHARS), and run the same check inside parse_header_args so --save-auth cannot persist poisoned headers to config.json before AgentConfig construction. https://claude.ai/code/session_01PACTmRta6eyqmZkaAwBpnF
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 32486128 | Triggered | Bearer Token | 765e48b | tests/test_cli.py | View secret |
| 32486128 | Triggered | Bearer Token | 765e48b | tests/test_cli.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
4 tasks
Contributor
Author
Contributor
Author
|
Acknowledged — noted that #585 landed and supersedes this draft. Nothing further needed on this PR. Triaged by Claude Code. Session: https://claude.ai/code/session_01Lr5c2q1r21kjDiBaiar5Wy Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #583
Summary
Adds
AgentConfig.extra_headers(dict[str, str] | None) so callers can pass routing and context headers — likex-adcp-tenantfor multi-tenant platforms — alongsideauth_token. Plumbed through both MCP and A2A transport layers. Auth always wins on conflict (with alogger.warning). The--header KEY=VALUECLI flag (repeatable,-Halias) is persisted via--save-authand honoured on subsequent invocations.Before:
After:
What was tested
pytest tests/test_client.py tests/test_cli.py— all 97 passed (15 new tests added)test_real_tls_handshake_still_validates_hostnamehitsexample.com)ruff check src/: all checks passedmypy src/adcp/types/core.py src/adcp/config.py src/adcp/__main__.py: no new errors (pre-existing missing-stub errors are infrastructure-wide, not introduced here)Known nits (not fixed, surfaced by pre-PR review)
extra_headers or Noneinhandle_save_authis redundant (harmless,parse_header_argsalready returnsNonefor empty input)auth_header(e.g.x-adcp-auth) for bothtokenandbearerauth types; A2A usesAuthorizationforbearer. This asymmetry predates this PR. A conflict warning on MCP+bearer only fires if the user'sextra_headerskey matchesauth_header(not"Authorization")."conflicts with auth_header", A2A says"conflicts with auth header".extra_headersvalues reach the outgoinghttpx.AsyncClientheaders kwarg (future integration test opportunity).Pre-PR review:
parse_header_argsso--save-authpath is protected before config writeextra_headersmatches webhooks.py convention;partition("=")correctly handles base64 values; CLI error messages actionable;--list-agentsshows key names only (correct for security)Session: https://claude.ai/code/session_01PACTmRta6eyqmZkaAwBpnF
Generated by Claude Code