Skip to content

Commit

Permalink
fix: improve validation of resolve request
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstimothy committed Dec 19, 2024
1 parent 29702f3 commit 05b337b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/auth/auth_with_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ func (a *ServerWithRoles) ResolveSSHTarget(ctx context.Context, req *proto.Resol
switch {
case req.Host != "":
if len(req.Labels) > 0 || req.PredicateExpression != "" || len(req.SearchKeywords) > 0 {
a.authServer.logger.WarnContext(ctx, "ssh target resolution request contained both host and label information - ignoring labels")
a.authServer.logger.WarnContext(ctx, "ssh target resolution request contained both host and a resource matcher - ignoring resource matcher")
}

resp, err := a.GetSSHTargets(ctx, &proto.GetSSHTargetsRequest{
Expand Down Expand Up @@ -1753,7 +1753,7 @@ func (a *ServerWithRoles) ResolveSSHTarget(ctx context.Context, req *proto.Resol

}
default:
return nil, trace.NotFound("no matching hosts")
return nil, trace.BadParameter("request did not contain any host information or resource matcher")
}

switch len(servers) {
Expand Down

0 comments on commit 05b337b

Please sign in to comment.