The vulnerability exists in the @farmfe/core package's development server. Specifically, the WebSocket server used for Hot Module Replacement (HMR) did not validate the Origin header of incoming connection requests. This flaw is located in the WsServer class within packages/core/src/server/ws.ts.
The root cause is in the isHMRRequest method, which was responsible for validating incoming HMR requests. Prior to the patch, this method only checked the request URL and the sec-websocket-protocol header, but critically omitted a check on the Origin header. This allowed a malicious website visited by a developer to establish a WebSocket connection to their local Farm development server.
The handleUpgrade method, which is the entry point for handling these upgrade requests, would call the vulnerable isHMRRequest method. If it returned true (which it would for a malicious request with the correct URL and protocol header), handleUpgrade would proceed to establish the WebSocket connection, allowing the malicious site to steal source code and other sensitive information from the developer's machine.
The patch, committed in 83342ef06e0aea37270950fd8c930422c4df0679, rectifies this by adding an origin check within the isHMRRequest function. It generates a list of allowed origins based on the server configuration and validates the Origin header of incoming requests against this list. This ensures that only trusted origins can connect to the HMR WebSocket server.