Skip to content

feat(license): inject X-Axonflow-Client header on every governed request#161

Merged
saurabhjain1592 merged 1 commit intomainfrom
license/x-axonflow-client-header
May 5, 2026
Merged

feat(license): inject X-Axonflow-Client header on every governed request#161
saurabhjain1592 merged 1 commit intomainfrom
license/x-axonflow-client-header

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

Per ADR-050 §4, every governed client must set X-Axonflow-Client: <client-id>/<version> on every request to the agent.

This is the sdk-java half of getaxonflow/axonflow-enterprise#1881.

Changes

  • AxonFlowConfig.java::getClientHeader() — new accessor returning sdk-java/<SDK_VERSION>. No config / env override (honest-99% per ADR-050 §4).
  • AxonFlow.java — stamps X-Axonflow-Client at every Request.Builder site that already sets User-Agent (5 sites) plus inside addAuthHeaders() so any builder going through the central auth helper picks it up. OkHttp's Builder.header() replaces, so the small overlap is benign.
  • ClientHeaderTest.java — new test (2 assertions: forwarded on proxyLLMCall + format check).

Verification

  • mvn test -Dtest=ClientHeaderTest — 2 / 2 passing
  • mvn test — full suite: 1228 tests, 0 failures, 0 errors, BUILD SUCCESS

Per ADR-050 §4, every governed client must set
`X-Axonflow-Client: <client-id>/<version>` on every request to the agent
so the agent can derive request scope (sdk) and validate it against the
token's aud.scope via HasScope().

This PR:
- Adds AxonFlowConfig.getClientHeader() which returns "sdk-java/<SDK_VERSION>".
  Sourced from the bundled SDK_VERSION; no env / config override (the
  consumer doesn't get to spoof its own client identity to the agent).
- Stamps the header alongside User-Agent at every Request.Builder site
  in AxonFlow.java that already sets User-Agent (5 sites).
- Stamps the header inside addAuthHeaders() so any builder that calls
  addAuthHeaders without explicit User-Agent (e.g. the providers
  listing path at AxonFlow.java:1922) also ships it. OkHttp's
  Builder.header() replaces, so the small overlap with the explicit
  per-site stamps just resets the same value.

Test coverage:
- ClientHeaderTest asserts X-Axonflow-Client is forwarded on
  proxyLLMCall and pins the agent-parseable "sdk-java/<semver>" format.
- Full Maven test suite stays green: 1228 tests, 0 failures.

Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
@saurabhjain1592 saurabhjain1592 merged commit 690b12f into main May 5, 2026
18 checks passed
@saurabhjain1592 saurabhjain1592 deleted the license/x-axonflow-client-header branch May 5, 2026 01:26
saurabhjain1592 added a commit that referenced this pull request May 6, 2026
…se validation [skip-runtime-e2e] (#163)

Companion release to platform v7.7.0. The Java SDK now sends
X-Axonflow-Client: sdk-java/<version> on every governed request, which
the agent (v7.7.0+) uses to derive SDK request scope and validate
against any license token's audience claim per the ADR-050 license
matrix.

Single substantive change since v7.0.0 (#161 — header injection).
Supporting commits since v7.0.0 (DCO sign-off docs, definition-of-done
CI gate, v7.0.0 changelog typo correction) are infrastructure and not
user-facing.

No public API changes. Existing v7.0.x callers update
<version>7.7.0</version> and rebuild against v7.7.0 with no source
changes.

Backward-compatible against pre-v7.7.0 agents (header silently dropped).

[skip-runtime-e2e] — version + CHANGELOG bump only; the underlying
header behavior shipped + was runtime-tested when #161 landed.

Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant