Repository navigation
test(security): count only bridge connections on the fake VNC server - #503
Open
phatloi0010 wants to merge 1 commit into
Open
phatloi0010 wants to merge 1 commit into
phatloi0010 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test/security/security-viewer-bridge.test.tsstarts a fake loopback VNC server (upstream) inbeforeEachand previously pushed every accepted TCP socket intosockets. On a host where a local process probes new loopback listeners (such as an IDE port detector / T3 Code, as in #480), those external connections were appended tosocketsand brokeexpect(sockets).toHaveLength(0)assertions in tests where the viewer bridge rightly refused to connect to VNC.This change verifies that the client side of an accepted loopback connection on
upstreambelongs to the current test process (process.pid) by matching the peer endpoint (0100007F:<remotePort> -> 0100007F:<localPort>) in/proc/net/tcpagainst socket descriptors in/proc/<pid>/fd. Connections from any other process are immediately destroyed (so a local port prober that keeps its end open also cannot holdupstream.close()open inafterEach) and excluded fromsockets.Other test servers across
test/andpackages/*/test/that count connections (native-viewer-host.test.ts,desktop-linux/test/integration.test.ts,x11-fixture.ts,request-takeover.test.ts) listen on Unix domain sockets rather than loopback TCP ports, anddevtools.test.tscounts HTTP requests rather than raw TCP connections.Closes #492
No device pass: this changes one test file and no product behavior.
upstream/proc/net/tcpand/proc/<pid>/fd; immediatesocket.destroy()for foreign peersprocess.pidare recorded insockets; external port prober connections are destroyed and ignoredcreateServerlisteners acrosstest/andpackages/*/test/host.sock,busPath,this.socketPath), not loopback TCP ports