Files
flipper/desktop/flipper-server
Lorenzo Blasa 238f40f55d Mandate auth token to connect over TCP
Summary:
Until now, launching flipper-server with TCP would accept any incoming connection as long as it comes from the same origin (localhost) using web socket host origin verification.

This is not entirely secure as origin can be spoofed with tools like curl.

Our team created a security review and a proposal was written:
https://docs.google.com/document/d/16iXypCQibPiner061SoaQUFUY9tLVAEpkKfV_hUXI7c/

Effectively, Flipper can generate a token which is then used by the client to authenticate.

This diff contains the changes required to generate, obtain, and validate authentication tokens from clients connecting to flipper over TCP connections.

The token itself is a JWT token. JWT was chosen because it is a simple industry standard which offers three features which can immediately benefit us:

- Expiration handling. No need for Flipper to store this information anywhere.
- Payload. Payload can be used to push any data we deem relevant i.e. unix username.
- Signing. Signed and verified using the same server key pair which is already in place for certificate exchange.

Additionally, the token is stored in the Flipper static folder. This ensures that the browser and PWA clients have access to it.

Reviewed By: mweststrate

Differential Revision: D45179654

fbshipit-source-id: 6761bcb24f4ba30b67d1511cde8fe875158d78af
2023-05-05 07:52:13 -07:00
..
2023-01-25 04:35:09 -08:00

flipper-server (TBD)

Stand alone Flipper server as NodeJS process, that uses flipper-server-core for device communication and also provides a webserver to serve flipper-ui.

Flipper-server can be used as background process, for example on CI servers or to power IDE plugins.

Running flipper server

From NPM

TODO:

From source

cd <Flipper checkout>/desktop
yarn install
yarn flipper-server

Production build from source

cd <Flipper checkout>/desktop
yarn install
yarn build:flipper-server

Pass the --open flag to open Flipper server after building

Use --no-rebuild-plugins to speed up subsequent builds if default plugins have been build already