Skip to content

GetAllowedOAuthClientCredentials ignores the requested client #53

Open

Description

@brinehart

File: core/csharp/MicroZen.Api/Services/ClientsGrpcService.cs:66-78

What this is: Meant to return the OAuth2 credentials a given client is allowed to use.

Problem: The query does SelectMany(c => c.AllowedClientOAuth2Credentials) across all clients and never filters by request.Id. It returns every allowed-credential row in the database. Also allowedCredentials is null can never be true for a ToListAsync() result, so the not-found path is dead.

Fix: Filter .Where(c => c.Id == request.Id) before SelectMany; drop the null check or replace it with a .Count == 0 check.

If we skip it: Cross-tenant leak of OAuth2 credentials, plus a useless branch.

Activity

  1. added
    Should FixRisky code without a test, real slowness, duplication, or code that should not exist
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Should FixRisky code without a test, real slowness, duplication, or code that should not exist

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions