This website requires JavaScript.
Explore
Help
Sign In
PenaDevops
/
delve
Watch
2
Star
0
Fork
0
You've already forked delve
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
ab38d71147
delve
/
service
/
internal
/
sameuser
/
sameuser.go
10 lines
104 B
Go
Raw
Normal View
History
Unescape
Escape
dap: add sameuser check (#2494) On linux, delve RPC server allows only connections from the same user if --only-same-user is set (true, by default). Do the same for DAP server. Moved the sameuser check logic to service/internal/sameuser. Considered importing service/rpccommon from the dap server, but when we eventually migrate to multiplex rpc and dap from one port, I am afraid that can cause cyclic imports.
2021-05-19 17:29:05 +00:00
//+build !linux
package
sameuser
import
"net"
service: fix sameuser check (#2642) Change the socket search to check both the remote and local fields of the socket match the socket we want to find. Sockets are identified by the 4-uple local_addr, local_port, remote_addr, remote_port Two socket can differ by a single one of this four elements. It is possible for the same local_port to be used by two different sockets, as long as they are connecting to different remote addresses (or remote ports). An example of this bug in action can be seen at: https://github.com/golang/vscode-go/runs/3141270564?check_suite_focus=true There the server starts listening on 127.0.0.1:46011 and rejects a valid client connection by finding the following socket: 60: 0100007F:DD82 0100007F:962D 06 00000000:00000000 03:00000133 00000000 0 0 0 3 0000000000000000 the local address of this socket is 0100007F:DD82 (127.0.0.1:56706), and the remote address is 0100007F:962D (127.0.0.1:38445). The reported error is: closing connection from different user (127.0.0.1:56706): connections to localhost are only accepted from the same UNIX user for security reasons note how the local port does match the socket line (56706) but the remote port is wrong (38445 instead of 46011). Note also that the state of this socket is 06, or TIME_WAIT, which would be impossible if this was the right socket, since the right socket would still be open. Fixes https://github.com/golang/vscode-go/issues/1555
2021-08-10 09:40:39 +00:00
func
CanAccept
(
_
,
_
,
_
net
.
Addr
)
bool
{
dap: add sameuser check (#2494) On linux, delve RPC server allows only connections from the same user if --only-same-user is set (true, by default). Do the same for DAP server. Moved the sameuser check logic to service/internal/sameuser. Considered importing service/rpccommon from the dap server, but when we eventually migrate to multiplex rpc and dap from one port, I am afraid that can cause cyclic imports.
2021-05-19 17:29:05 +00:00
return
true
}
Reference in New Issue
Copy Permalink