Skip to content

fix(notifications): allow internal subscribers#28

Open
emerson-gray wants to merge 2 commits intomainfrom
fix/internal-subscribers
Open

fix(notifications): allow internal subscribers#28
emerson-gray wants to merge 2 commits intomainfrom
fix/internal-subscribers

Conversation

@emerson-gray
Copy link
Copy Markdown

Fixes two issues seen post-rollout:

  1. Internal services (e.g. orchestrator) subscribing without x-identity-id were rejected with Unauthenticated, causing noisy retry/spam.
  2. workload:{id} room subscriptions were overly strict.

Changes:

  • If x-identity-id header is missing, treat subscriber as internal/trusted and skip per-room authz checks.
    • Still validates room kinds (unknown kinds rejected for all subscribers).
  • External subscribers (with identity) remain authorized per room.
  • workload:{id} / agent:{id} rooms now require org member.

Tests updated to cover the internal subscriber path.

Copy link
Copy Markdown

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: allowing Subscribe calls without x-identity-id (treating them as trusted internal) is a security hole and bypasses room authz. Please keep missing identity as Unauthenticated and instead authenticate internal subscribers explicitly (send identity metadata, service token, mTLS, or a separate internal Subscribe RPC). Minor note inline about workload/agent room relation change to member.

Comment thread internal/server/server.go
Comment thread internal/server/server_test.go Outdated
Comment thread internal/server/authz.go
@casey-brooks
Copy link
Copy Markdown
Contributor

Summary

  • Add internal subscribe token config and authorization via x-service-token for internal rooms.
  • Enforce allowlisted internal room prefixes and update server tests/client setup.

Testing

  • go test ./... (passed: all, failed: 0, skipped: 0)
  • golangci-lint run ./... (no issues)

Copy link
Copy Markdown

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review: the internal subscribe path is now gated behind an explicit x-service-token (INTERNAL_SUBSCRIBE_TOKEN) and restricted to an allowlist of room kinds, which fixes the previous authz bypass. Tests updated accordingly. (Minor: PR description still describes the old “missing identity == trusted” behavior; consider updating for clarity.)

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.

3 participants