Commit Graph

15 Commits

Author SHA1 Message Date
Andrey Goncharov
4b3f572205 Preserve previous error messages
Reviewed By: passy

Differential Revision: D51197113

fbshipit-source-id: 237c6f1f894cb4d758150ff2bddf14c104d3b381
2023-11-10 03:39:32 -08:00
Lorenzo Blasa
db4d15ed05 URL and Token provider
Summary:
Use an URLProvider paired with a token provider for attempts to establish a websocket connection.

This gives extra flexibility whenever a token is not available or changes as the ReconnectingWebSocket will call the URLProvider after each unsuccessful connection.

Reviewed By: antonk52

Differential Revision: D50220329

fbshipit-source-id: f53993a90c9c0f64bf213019b6b8af5fa818048d
2023-10-12 04:29:13 -07:00
Lorenzo Blasa
541570c8ab Add client logs for different stages
Summary: ^

Reviewed By: antonk52

Differential Revision: D49973541

fbshipit-source-id: 3bac97fb22586cc49e74dd5deceeb5310a1385bc
2023-10-05 22:42:37 -07:00
Lorenzo Blasa
7d77be1c9d Remove 'exec' debug logs
Summary: These are quite verbose even when debugging, so remove.

Reviewed By: ivanmisuno

Differential Revision: D49538582

fbshipit-source-id: 089027390a825dde3d3d53b67e3f920f2f1f75f2
2023-09-22 10:36:43 -07:00
Lorenzo Blasa
b8950a2298 Kill with -9 flag
Summary: There are reports in which kill as is doesn't kill the process. Using the '-9' flag does, so update troubleshoot message.

Reviewed By: LukeDefeo

Differential Revision: D49537427

fbshipit-source-id: a062c92528589cecf0f41e1c344c5d0ae1c3345d
2023-09-22 08:17:48 -07:00
Pascal Hartig
554d2f9b83 Bump ES level to 2021
Summary: Updating the remaining tsconfigs to build for an ES2021 target.

Reviewed By: antonk52

Differential Revision: D48687661

fbshipit-source-id: 2761704d251f701594ca5d362a17731f287088ed
2023-08-29 05:06:18 -07:00
Lorenzo Blasa
9e2615cd80 Better troubleshoot guide to kill existing running instance
Summary: Combine the two used commands as will make things easier for our users.

Reviewed By: passy

Differential Revision: D48266474

fbshipit-source-id: 1ee5c568ff001dc5ba3f11e21b09a2a6ab430ac7
2023-08-11 14:16:21 -07:00
Lorenzo Blasa
a21f730c2d Better lsof to find process
Summary:
The previous recommendation doesn't always holds true. There are reported cases in which a process is listening to the specified port yet is not being listed by the lsof command as advised.

The command below seems to work better.

    sudo lsof -i :52342

Reviewed By: antonk52

Differential Revision: D47989269

fbshipit-source-id: ea216de00ef6edc90de58e9d3fe3a0579a171fea
2023-08-02 07:56:17 -07:00
Lorenzo Blasa
353e51e2ea Better error message format
Summary:
The existing error message was not in the centre and didn't give any possible remediation steps.

{F1015240268}

Reviewed By: passy

Differential Revision: D46394149

fbshipit-source-id: 09d450bef9df83c5b3af3ba49c7e0fafb81bfdce
2023-06-02 09:35:32 -07:00
Lorenzo Blasa
c6d5eb3334 Flipper as PWA
Summary:
^

Reference: https://docs.google.com/document/d/1flQJUzTe4AuQz3QCpvbloQycenHsu7ZxbKScov7K7ao

Reviewed By: passy

Differential Revision: D45693382

fbshipit-source-id: 5a2e6c213a7e7e2cf9cd5f3033cff3e5291a2a92
2023-05-16 04:32:47 -07:00
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
Andrey Goncharov
26241cf5c0 Skip logging data for the 'upload-scibe-logs-event''
Summary:
Logging data for this event turnslogs into unreadable mess
{F789339377}

Reviewed By: lblasa

Differential Revision: D40978819

fbshipit-source-id: ac0894b2a490aa902180c50e7712b168211c7013
2022-11-04 08:23:44 -07:00
Andrey Goncharov
2a108854d2 Make flipper-server-client gracefully handle malformed messages
Summary: FlipperServerClient can use any socket to transfer the data. Since we do not control the socket, we cannot guarantee what comes out of it (hello, Jest E2E tunnel!). We need to handle unexpected messages gracefully.

Reviewed By: passy

Differential Revision: D40891384

fbshipit-source-id: 6f873037aa49bac3fc4c09fa49483cdec537ae40
2022-11-03 06:57:17 -07:00
Andrey Goncharov
60a439ef7b Remove window refernce from flipper-server-client
Summary: Remove `window` reference to use flipper-server-client in NodeJS context (windows is not defined there)

Reviewed By: passy

Differential Revision: D40859805

fbshipit-source-id: 23415f9d504e4dbba4035b942c73add86edf02de
2022-11-03 06:57:17 -07:00
Andrey Goncharov
226ccf91f6 Create flipper-server-client package
Summary:
FlipperServerClient is a useful abstraction for any JS-based client of headless Flipper. No need to bundle it with flipper-frontend-core, as the rest is not useful for external clients.
Currently, I am planning to add it to jest-e2e to send commands to Flipper

Reviewed By: lblasa

Differential Revision: D40765668

fbshipit-source-id: af48710bb15444ac1ecd649fe9a2ab252f3088f3
2022-10-31 04:26:43 -07:00