1. 10 8月, 2021 1 次提交
    • A
      service: fix sameuser check (#2642) · 51375157
      Alessandro Arzilli 提交于
      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
      51375157
  2. 20 5月, 2021 1 次提交
    • H
      dap: add sameuser check (#2494) · 669fc2d8
      Hyang-Ah Hana Kim 提交于
      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.
      669fc2d8
  3. 26 11月, 2019 1 次提交