Skip to content

feat: add agent audience scope to platform clients during registration - #172

Merged
mrsabath merged 1 commit into
rossoctl:mainfrom
mrsabath:feat/audience-scope-platform-clients
Mar 6, 2026
Merged

mrsabath merged 1 commit into
rossoctl:mainfrom
mrsabath:feat/audience-scope-platform-clients

Conversation

@mrsabath

@mrsabath mrsabath commented Mar 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Client-registration sidecar now creates an audience scope for the agent and adds it to platform clients (e.g., the kagenti UI client)
  • This eliminates the need for manual Keycloak configuration to make AuthBridge-protected agents reachable from the UI
  • New optional env vars: PLATFORM_CLIENT_IDS (default: kagenti), KEYCLOAK_AUDIENCE_SCOPE_ENABLED (default: true)

Problem

When an agent with AuthBridge is deployed, the client-registration sidecar registers it as a Keycloak client, but existing clients (like the UI) don't get the agent's audience scope. This means the UI can't chat with AuthBridge-protected agents — the token's audience doesn't include the agent's SPIFFE ID.

Solution

After registering the client, the sidecar now:

  1. Creates an audience scope (agent-{namespace}-{name}-aud) with an audience mapper
  2. Adds it as a realm default (for future clients)
  3. Explicitly adds it to platform clients specified by PLATFORM_CLIENT_IDS

All operations are idempotent. The feature is enabled by default and can be disabled with KEYCLOAK_AUDIENCE_SCOPE_ENABLED=false.

Files changed

  • AuthBridge/client-registration/client_registration.py — Core audience scope logic
  • kagenti-webhook/internal/webhook/injector/container_builder.go — Pass PLATFORM_CLIENT_IDS env var to sidecar
  • kagenti-webhook/internal/webhook/injector/container_builder_test.go — Test for new env var
  • AuthBridge/demos/single-target/k8s/configmaps-webhook.yaml — Document new config option

Test plan

  • Go unit test passes (TestBuildClientRegistrationContainer_HasPlatformClientIDsEnv)
  • All existing injector tests pass (30/30)
  • Tested on Kind cluster — scope created, added to kagenti UI client
  • Verified idempotency — multiple pod restarts produce no errors
  • E2E: UI can chat with AuthBridge-protected agent after deploy (no manual Keycloak step)

Closes #169

🤖 Generated with Claude Code

The client-registration sidecar now creates an audience scope for the
agent and adds it to platform clients (e.g., the kagenti UI client)
so AuthBridge-protected agents are reachable from the UI without manual
Keycloak configuration.

New env vars (all optional with sensible defaults):
- PLATFORM_CLIENT_IDS: comma-separated client IDs (default: "kagenti")
- KEYCLOAK_AUDIENCE_SCOPE_ENABLED: toggle scope management (default: "true")

Closes: #169

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Mariusz Sabath <[email protected]>
@mrsabath
mrsabath force-pushed the feat/audience-scope-platform-clients branch from 9a9f8c3 to 69a0a76 Compare March 6, 2026 17:57
@mrsabath
mrsabath merged commit 0737227 into rossoctl:main Mar 6, 2026
3 checks passed
@mrsabath
mrsabath deleted the feat/audience-scope-platform-clients branch March 6, 2026 18:35
oblinder added a commit that referenced this pull request Sep 7, 2026
New src/aiac/agent/shared/error_logging.py: log_by_type(exc) routes each PRB exception to its per-persona named logger (aiac.onboarding.builder / llm_access / llm_response / contradiction) at ERROR with full context via exc_info (traceback + chained cause) to stdout; MRO walk so subclasses route to an ancestor, unmapped falls back to aiac.onboarding. Both PolicyContradictionError and the report-carrying PolicyConflictError route to aiac.onboarding.contradiction. Router only; Controller (#172) and the NATS consumer (#173) are the two call sites. 7 caplog tests.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Oleg Blinder <[email protected]>
oblinder added a commit that referenced this pull request Sep 7, 2026
Controller: add LLMAccessError->502, UnparseableLLMResponseError->502, and a PolicyRulesBuilderBaseError->500 safety-net; sanitize every non-ConflictReport body to {"detail": <static safe summary>} (never str(exc)), routing full detail (message, traceback, __cause__) to the per-persona named loggers via log_by_type. PolicyConflictError / PolicyContradictionError 422 ConflictReport bodies unchanged. 5 new tests assert status + absence of endpoint/host/key substrings.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Oleg Blinder <[email protected]>
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.

feat: client-registration should add agent audience scope to UI client

2 participants