Skip to content

Commit

Permalink
Add validation for case where port is specified without service
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar committed Nov 28, 2023
1 parent 5f061a7 commit fd746f9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions portal/daemon/port_forward_manager/port_forward_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func validateCreateUserServicePortForwardArgs(enclaveServicePort EnclaveServiceP
return stacktrace.NewError("EnclaveId is always required but we received an empty string")
}

if enclaveServicePort.ServiceId() == "" && enclaveServicePort.PortId() != "" {
return stacktrace.NewError("PortId (%v) was specified without a corresponding ServiceId", enclaveServicePort.PortId())
}

if requestedLocalPort != 0 {
if enclaveServicePort.ServiceId() == "" || enclaveServicePort.PortId() == "" {
return stacktrace.NewError("A static port '%d' was requested, but enclaveId, serviceId, and portId were not all specified: %v", requestedLocalPort, enclaveServicePort)
Expand Down

0 comments on commit fd746f9

Please sign in to comment.