Commit Graph

30 Commits

Author SHA1 Message Date
Lorenzo Blasa
27909e8296 Track CSR processing
Summary:
Need to answer:

- Certificate exchange success rate, fails and errors a day per OS and device type.

Reviewed By: antonk52

Differential Revision: D46221301

fbshipit-source-id: 03c6993aa15f56fdf98a7abd57d00b2af0e9ce1a
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
f25591580c Track insecure connection attempts
Summary: Same as previous diff but for plain socket.

Reviewed By: antonk52

Differential Revision: D46220933

fbshipit-source-id: 235ca860891b8514dd0d743d32fe85f15a2cdd7e
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
135d3e3aa8 Track secure connection attempts
Summary: Same as previous diff but for TLS attempts.

Reviewed By: antonk52

Differential Revision: D46220897

fbshipit-source-id: 9495c39edffbdebe0ba21ec7320b63bad8759dde
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
8065313949 Track app connections
Summary:
Need to answer:

- How many app connections a day/week?
- How many connections a day/week per app?
- How many connections a day/week per os?
- How many connections a day/week over WWW exchange?
- How many connections a day/week over FS exchange?
- How many connections over a device?
- How many connections over a simulator?

Reviewed By: antonk52

Differential Revision: D46220581

fbshipit-source-id: 6783f49b59cba91cd04625044314973d98cef301
2023-05-26 08:02:12 -07:00
Michel Weststrate
393e1f08d4 Added details to failing assertions
Summary: Added a clearer message to the null checks, to give some clue on what goes wrong

Reviewed By: lawrencelomax

Differential Revision: D35246065

fbshipit-source-id: d33a6184bf722a386c2b2dff1afd41db20efe90b
2022-03-30 03:33:42 -07:00
Andrey Goncharov
5068c8273b Add deprecation notice notification
Summary: Add deprecation notice device icon and notification

Reviewed By: lblasa

Differential Revision: D34582475

fbshipit-source-id: 90fde15caf1925b42f50fbfc77dece88c82833cf
2022-03-02 09:18:15 -08:00
Andrey Goncharov
3b390b74ff Track client connections and autostop server add-ons when all clients leave
Reviewed By: mweststrate

Differential Revision: D34045584

fbshipit-source-id: 1ad0cfffb9d304f0359c973d76d6956f7e932f72
2022-02-28 03:50:34 -08:00
Michel Weststrate
597f679ed3 Propagate errors properly when cert exchange fails
Summary:
Certificate exchange errors should be communicated back to the user, as they are often actionable, and otherwise leave users in a stuck state.

Also removed the ServerController interface, upgraded the listener types to get at the necessary internal apis typewise that were already available.

Removed that error wrapping utility complaining about idb installation, this is rarely ever the problem anymore, and it hides the underlying error.

Reviewed By: nikoant

Differential Revision: D34105452

fbshipit-source-id: 3b3cd0b99cecbda26dfd0744a90690fe568a5ea5
2022-02-09 04:22:25 -08:00
Andrey Goncharov
c238cef5b0 Verify certificate provider medium
Reviewed By: antonk52

Differential Revision: D33917041

fbshipit-source-id: 91a9554397063d53a903a5b1406b46ddf07360b2
2022-02-02 03:07:00 -08:00
Andrey Goncharov
51ef1810b2 Defer initialization of Android and iOS device managers
Summary: Remove hidden async initialization of adb and idb. Make it explicit. Remove nullable fields in Android and iOS device managers.

Reviewed By: lawrencelomax

Differential Revision: D33915177

fbshipit-source-id: 882f79310410e0dfde6169abf343ab808644e4a2
2022-02-02 03:07:00 -08:00
Andrey Goncharov
fd13399cb9 Extract WWW certificate provider
Summary: Extract WWW certificate provider from the iOS certificate provider. Hide its implementation from OSS since it is not relevant for OSS folks.

Reviewed By: mweststrate

Differential Revision: D33895378

fbshipit-source-id: 376afda3b5fa3857c0eb280b92555314eb1a0d1f
2022-02-02 03:07:00 -08:00
Andrey Goncharov
29f6d0e711 Add device-specific Certificate Providers
Reviewed By: mweststrate

Differential Revision: D33821880

fbshipit-source-id: c75c71db4d7dc680f75cf41ba2d5dad009a5fd03
2022-02-02 03:07:00 -08:00
Andrey Goncharov
b1f19ecd68 Extract certificate utils
Summary: Extract utilities for certificate server-side certificate handling

Reviewed By: lawrencelomax

Differential Revision: D33820263

fbshipit-source-id: 21f1a9ed5f3b83b8350151bdf6d8862aa0b18e8f
2022-02-02 03:07:00 -08:00
Andrey Goncharov
da618fd3f3 Decouple CertificateProvider and adb/idb client intialization
Summary:
Previously CertificateProvider initialized ADB and provided config to IDB. As result, AndroidDeviceManager and iOSDeviceManager indirectly depended on CertificateProvider.

With this diff we:
1. Make idbConfig resemble adbClient.
2. Make AndroidDeviceManager and iOSDeviceManager initialize their own clients
3. Fix server crash when one of the clients couldn't be initialized. The reason for the crash is CertificateProvider.prototype.init which is no longer needed.

Reviewed By: passy

Differential Revision: D33711652

fbshipit-source-id: 055b5625ed993827b65396f4af5157808479242b
2022-01-26 04:23:05 -08:00
Andrey Goncharov
3865a3d9a2 Support a custom port for the insecure connection flow
Summary:
1. Remove GK.get('comet_enable_flipper_connection') which does not seem to be needed anymore
2. Support custom ports for the insecure connection flow

Reviewed By: lblasa

Differential Revision: D33632891

fbshipit-source-id: 045d6886ea94e15bff38f2f61c7d5a2c56c39859
2022-01-18 05:52:57 -08:00
Michel Weststrate
b6c884f011 Make sure flipper server initialization errors are propagated properly
Summary:
This diff makes sure that errors are propagated similarly in flipper desktop and browser version, and that they are shown in either case.

Since in the browser version, the UI loads after the error happened, we'll store the error so that any client connecting in the future will read and report it.

Also added a `--failFast` flag to flipper-server, so that the process exits immediately if misconfigured, which is convenient in CI use cases and such

Reviewed By: nikoant

Differential Revision: D33348922

fbshipit-source-id: 0f584104f881141fde38da3f0031748415343ea2
2022-01-04 02:57:25 -08:00
Michel Weststrate
8259f92983 Make sure Flipper server startup errors are propagated for desktop
Summary:
If openssl is not available, this would lead to an unhandled rejection exception. That is because a lot initialization logic generates promises that don't get a catch chained on immediately. Changed the flipper server startup flow to be more idiomatically async

Fixes https://github.com/facebook/flipper/issues/2766

Changelog: More clearly communicate if flipper server failed to start (e.d. due to port already taken, openssl not being available)

This change fixes it only for desktop flipper, will make sure the browser UI will support this as well (the error will fire correctly there, but there are no listeners during startup)

Reviewed By: nikoant

Differential Revision: D33348923

fbshipit-source-id: f561bb27b18a3041c514b37f7aed11435a49647f
2022-01-04 02:57:25 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Michel Weststrate
cea7be7fde Clean up globals
Summary: This diff is some boyscouting on cleaning up our globals, and stop using them inconsistently icmw global or window

Reviewed By: aigoncharov

Differential Revision: D33171108

fbshipit-source-id: 400893e5f31523631a7ab6fda428524c751901f1
2021-12-17 10:04:23 -08:00
Michel Weststrate
dcfeb4a4d5 Clean up packages and types
Summary:
This diff removes most deps from the root package.json, which now only contains electron and shared build / test infra structure: lint, prettier, jest, typescript.

This makes it possible to control much better which packages are used where, as all sub packages now have their deps explicitly in their package.json instead of incidentally shared. This allows for example to disable DOM types for all packages by default (flipper-plugin, ui(-core) and app still request it), and in the next diff I hope to add to this that nodeJS types are no longer shared either, so that UI oriented packages will generate compile errors when using Node built-ins

This diff removes most deps that were currently unused, and dedupes a bunch of other ones, so the build should probably be a bit smaller now as well:

{F686704253}

{F686704295}

Reviewed By: antonk52

Differential Revision: D33062859

fbshipit-source-id: 5afaa4f2103d055188382a3370c1fffa295a298a
2021-12-16 14:54:59 -08:00
Michel Weststrate
943d535e86 Move sending intern requests from client to server
Summary: This diff moves send intern request from the browser to the server. The reason to make this change is that making such requests from a browser environment causes CORS restrictions to kick in.

Reviewed By: nikoant

Differential Revision: D32835449

fbshipit-source-id: e8e92e51ca963aa50b3c859bb61c2381171e85ae
2021-12-08 04:30:57 -08:00
Michel Weststrate
bca169df73 Move settings, launcherSettings, GKs to app / flipper-server-core
Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).

This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.

Reviewed By: passy, aigoncharov

Differential Revision: D32498649

fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
2021-12-08 04:30:54 -08:00
Pascal Hartig
3e258c6969 Demote connection loop error
Summary: We can't action tasks based on this report, so better to raise it as a warning.

Reviewed By: nikoant

Differential Revision: D32758850

fbshipit-source-id: 2e8ff984f40d2d0431db192e8f2d983d52b77ccd
2021-12-01 10:46:41 -08:00
Lorenzo Blasa
b37b5ee19e Track client connect/disconnect events
Summary: By tracking when clients connect and disconnect, we will be able to answer how long does it take for clients to connect

Reviewed By: passy

Differential Revision: D32697702

fbshipit-source-id: b01893f500c97b08eb4434733058f58433d7f4ef
2021-12-01 06:37:02 -08:00
Lorenzo Blasa
c18207afaf Remove CSR from trusted-request-handler event tracker
Summary: ^

Reviewed By: nikoant

Differential Revision: D32695273

fbshipit-source-id: 9c9c3e9da83f864f512d66a208fa87f0ded392d3
2021-11-29 08:59:10 -08:00
Lorenzo Blasa
e5bc40c59f Remove WebSocket GK
Summary:
This change removes the usage of a GK to open WebSocket ports.

The WebSocket ports have been open for quite a while to all members of the Flipper Support Group. OSS users will now open the ports as well.

Reviewed By: mweststrate

Differential Revision: D32244706

fbshipit-source-id: e441dfd43c51dda26f259ae7d7ebc3d721cc1c99
2021-11-08 04:35:53 -08:00
Andrey Goncharov
9d41c3c44c Fix device connection timeout notification
Summary:
Currently, when a new app connects to Flipper, we show a lost connection notification even though it successfully connects to Flipper.
It happens because we of the device_id mismatch.

Reviewed By: mweststrate

Differential Revision: D32169917

fbshipit-source-id: 6df3ae7fd621b4549e18c1835473a13f18cfb339
2021-11-04 09:12:56 -07:00
Andrey Goncharov
37498ad5a9 Refactor server implementation for WebSockets
Summary:
Standardize WS implementation for JS environments.

Why do we need a separate server implementation for browsers?
Browser targets cannot authenticate via the default certificate exchange flow. For browser targets we verify the origin instead.
Moreover, for already forgotten reasons the initial implementation of the WS server for browsers used a different kind of message structure and added extra `connect`/`disconnect` messages. After examination, it seems the `connect`/`disconnect` flow is redundant.

Major changes:
1. Updated class hierarchy for WS server implementations.
2. Updated browser WS server to support the modern and the legacy protocols.
3. Now a websocket connection with the device is closed on error. The idea is it is highly unlikely to handle any subsequent messages properly once we observe an error. It is better to bail and reconnect. What do you think?

Reviewed By: mweststrate

Differential Revision: D31532172

fbshipit-source-id: f86aa63a40efe4d5263353cc124fac8c63b80e45
2021-10-21 03:34:15 -07:00
Anton Nikolaev
976e53ff9b Avoid logging csr
Summary: I unintentionally added logging of csr certificates in my previous diff. This diff makes sure we're not logging them anymore.

Reviewed By: mweststrate

Differential Revision: D31609709

fbshipit-source-id: e43b348dbd62653f8a6e9089930c2a3699b29a12
2021-10-13 08:38:56 -07:00
Michel Weststrate
d88b28330a Move app/server to flipper-server-core
Summary: moved `app/src/server` to `flipper-server-core/src` and fixed any fallout from that (aka integration points I missed on the preparing diffs).

Reviewed By: passy

Differential Revision: D31541378

fbshipit-source-id: 8a7e0169ebefa515781f6e5e0f7b926415d4b7e9
2021-10-12 16:00:52 -07:00