requireAgentAccess authenticates the caller and confirms it may act as agentID. Account-scoped credentials may act as any agent they own (ownership is still checked separately by the handler). An agent-scoped credential is pinned: it may act ONLY as the single agent it is bound to — any other agent
(ctx context.Context, agentID string)
| 52 | // pinned: it may act ONLY as the single agent it is bound to — any other agent |
| 53 | // is 403, even if the same owner owns both. |
| 54 | func (s *Server) requireAgentAccess(ctx context.Context, agentID string) (*identity.Principal, error) { |
| 55 | p, err := s.requirePrincipal(ctx) |
| 56 | if err != nil { |
| 57 | return nil, err |
| 58 | } |
| 59 | if p.Scope == identity.ScopeAgent && p.AgentID != agentID { |
| 60 | return nil, NewError(http.StatusForbidden, "forbidden", |
| 61 | "this agent-scoped credential is bound to a different agent") |
| 62 | } |
| 63 | return p, nil |
| 64 | } |
nothing calls this directly
no test coverage detected