Track secure connection attempts

Summary: Same as previous diff but for TLS attempts.

Reviewed By: antonk52

Differential Revision: D46220897

fbshipit-source-id: 9495c39edffbdebe0ba21ec7320b63bad8759dde
This commit is contained in:
Lorenzo Blasa
2023-05-26 08:02:12 -07:00
committed by Facebook GitHub Bot
parent 8065313949
commit 135d3e3aa8
2 changed files with 15 additions and 15 deletions

View File

@@ -213,7 +213,6 @@ export class ServerController
}
onConnectionClosed(clientId: string) {
// TODO: track connections closed.
this.removeConnection(clientId);
}
@@ -222,22 +221,20 @@ export class ServerController
}
onSecureConnectionAttempt(clientQuery: SecureClientQuery): void {
// TODO: track secure connection attempt.
const strippedClientQuery = (({device_id, ...o}) => o)(clientQuery);
let id = buildClientId({device_id: 'unknown', ...strippedClientQuery});
const tracker = this.timestamps.get(id);
if (tracker) {
const timestamp = this.timestamps.get(id);
if (timestamp) {
this.timestamps.delete(id);
}
id = buildClientId(clientQuery);
this.timestamps.set(id, {
secureStart: Date.now(),
...tracker,
...timestamp,
});
this.logger.track(
'usage',
'trusted-request-handler-called',
tracker.track(
'app-connection-secure-attempt',
(({csr, ...o}) => o)(clientQuery),
);

View File

@@ -9,6 +9,14 @@
import {getLogger} from 'flipper-common';
type AppConnectionPayload = {
app: string;
os: string;
device: string;
device_id: string;
medium: number | undefined;
};
type TrackerEvents = {
'server-started': {port: number; tcp: boolean};
'server-auth-token-verification': {
@@ -18,13 +26,8 @@ type TrackerEvents = {
};
'server-socket-already-in-use': {};
'server-proxy-error': {error: string};
'app-connection-created': {
app: string;
os: string;
device: string;
device_id: string;
medium: number | undefined;
};
'app-connection-created': AppConnectionPayload;
'app-connection-secure-attempt': AppConnectionPayload;
};
class ServerCoreTracker {