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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user