fix: collapse ProxyStream auth failures into one indistinguishable response
This commit is contained in:
@@ -24,7 +24,11 @@ func (s *vantageServer) ProxyStream(stream pb.Vantage_ProxyStreamServer) error {
|
||||
|
||||
srv, err := services.ValidateAgentToken(msg.Open.ServerId, msg.Open.AgentToken)
|
||||
if err != nil {
|
||||
return status.Error(codes.Unauthenticated, "invalid agent token")
|
||||
// Deliberately identical to the claim-failure response below: a bad
|
||||
// token, an unknown proxy_id, and a proxy_id belonging to another
|
||||
// instance/server must be indistinguishable to the caller.
|
||||
log.Printf("proxy %s (server %s): invalid agent token", msg.Open.ProxyId, msg.Open.ServerId)
|
||||
return status.Error(codes.PermissionDenied, "proxy session unavailable")
|
||||
}
|
||||
|
||||
if err := serveProxy(proxy.Default, msg.Open, srv.InstanceID, stream); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user