fix(32.2): WR-03 refuse an unknown MCPGrant.Subject instead of treating it as a user grant

pier now resolves only the empty subject (frontend user grant) and pact.MCPGrantSubjectBackend; any other value is ErrUnauthorized and never reaches the linked-administrator lookup.
This commit is contained in:
Jakub Zych
2026-11-21 09:11:46 +01:00
parent 1dcc2ed06d
commit 19bb3f9485
6 changed files with 18 additions and 6 deletions

View File

@@ -215,8 +215,15 @@ func (r *identityResolver) resolveOAuth(ctx context.Context, raw string) (Identi
if err != nil {
return Identity{}, ErrUnauthorized
}
if grant.Subject == pact.MCPGrantSubjectBackend {
switch grant.Subject {
case pact.MCPGrantSubjectBackend:
return resolveBackendGrant(grant)
case "":
// The frontend user grant, below.
default:
// An unknown subject kind (a newer plugin, a typo) is refused, never
// reinterpreted as a frontend user grant.
return Identity{}, ErrUnauthorized
}
if grant.UserID == 0 {
return Identity{}, ErrUnauthorized