Skip to content

fix(identitybroker): refuse registration under another owner - #2449

Merged
ChrisJBurns merged 1 commit into
mainfrom
fix/identitybroker-register-owner
Oct 21, 2026
Merged

ChrisJBurns merged 1 commit into
mainfrom
fix/identitybroker-register-owner

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Contributor

Summary

  • RegisterAgent now refuses a registration whose owner differs from the broker session's owner, with PERMISSION_DENIED. One session tree has one owner, so a mismatch is a pairing bug. Raised in review of #2443.
  • The rule is documented on identitybroker.Service, enforced by the stand-in, and covered by a contract test, so a real implementation that skips it fails the suite. Before, the contract helpers always copied the session's own owner, so nothing caught a missing check.
  • The host session is deliberately not compared with the broker session's. A child agent registers with its own host session while sharing its parent's broker session, so an equality check would refuse every child. RegisterAgentRequest.HostSessionID says so; checking that it belongs to the session's tree will be addressed later.

Issue relationship

Relates to #2446

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

Baseline checks

  • Linting: golangci-lint on internal/identitybroker/..., 0 issues. Only this package changes.
  • Fast offline test suite: go test -race ./internal/identitybroker/... passes. No package outside internal/identitybroker imports it.
  • Pre-review race suite (task test:race): not run; the change is confined to the package above.
  • Offline demo (go run ./cmd/mecademo): not affected.
  • Markdown changed: docs generation/link checks (task docs)
  • User docs/user-facing behavior changed: site build (task site:build)
  • Guarded engine API affected: compatibility check (task api:check)
  • Intentional engine API change: task api:update + engine/CHANGELOG.md

Also checked:

  • The contract test catches a missing owner check: with the stand-in's check removed, the new case fails.
  • Children are not refused: with an added host-session equality check, the stand-in test registering a child under its own host session fails.

Changes

File Change
internal/identitybroker/service.go The owner rule on Service; field docs on RegisterAgentRequest.HostSessionID and Owner
internal/identitybroker/standin/standin.go RegisterAgent compares the request's owner with the session's
internal/identitybroker/conformance/sessions.go Contract case: registration under another owner is refused
internal/identitybroker/standin/standin_test.go A child with its own host session still registers

User-facing change

None.

Special notes for reviewers

  • No reason code. The design's failure matrix gives registration under a different owner, and registration into a foreign session, a plain PERMISSION_DENIED. session_owned is the reason for refusing a session open, so it is not reused here.

API compatibility: no remote-observable change. The package is internal and not wired into any server.

RegisterAgent accepted a request naming one owner's broker session with
a different owner. One session tree has one owner, so refuse a mismatch
with PERMISSION_DENIED, the code the design's failure matrix gives
registration under a different owner. Document the rule on Service,
enforce it in the stand-in, and add a contract case so real
implementations are held to it.

The host session is not compared: a child agent registers with its own
host session while sharing its parent's broker session. Checking that it
belongs to the session's tree will be addressed later.

Co-authored-by: Mecatl <[email protected]>
@ChrisJBurns
ChrisJBurns merged commit 9c7c013 into main Oct 21, 2026
36 of 39 checks passed
@ChrisJBurns
ChrisJBurns deleted the fix/identitybroker-register-owner branch October 21, 2026 11:23
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 23, 2026
2 tasks
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.

2 participants