Skip to content

Say who is asking when looking a group up - #10

Merged
vitramir merged 1 commit into
mainfrom
forward-the-caller-to-groups
Aug 10, 2026
Merged

Say who is asking when looking a group up#10
vitramir merged 1 commit into
mainfrom
forward-the-caller-to-groups

Conversation

@vitramir

Copy link
Copy Markdown
Contributor

Found while fixing the same bug in users (users#31).

validatePrincipalSameOrg passes its incoming server context straight to groupsClient.GetGroup. gRPC keeps incoming and outgoing metadata apart, so the call arrives with no x-identity-id, and Groups rejects it:

func (s *Server) GetGroup(...) {
    ...
    if err := s.requireOrganizationMember(ctx, group.OrganizationID); err != nil {

The failure is Unauthenticated: missing identity id, surfacing as group lookup: ... when granting a group access to a private resource. Granting to a user or an agent takes the identityClient branch and is unaffected — which is presumably why it went unnoticed.

networks already reads x-identity-id off the incoming context for its own authorization; this reuses that to name the caller on the outgoing one.

The identityClient.GetIdentityType call in the same function is left alone: the identity service has no authorization checks, so it needs no caller.

Groups answers GetGroup only for a member of the group's organization, and
the caller was not on the request: gRPC keeps incoming and outgoing metadata
apart, so the context arrived anonymous.

It fails granting a group access to a private resource. Granting to a user
or an agent takes a different branch and was unaffected.
@vitramir
vitramir merged commit 7f4e6f9 into main Aug 10, 2026
1 check passed
@vitramir
vitramir deleted the forward-the-caller-to-groups branch August 10, 2026 01:38
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