Bug 1788290 - Add the telemetry for Web Privacy. r=keeler.

Differential Revision: https://phabricator.services.mozilla.com/D156107
This commit is contained in:
Dennis Jackson 2022-09-02 20:59:35 +00:00
Родитель 97f4470f70
Коммит a7c2f2a620
2 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -1201,6 +1201,39 @@ static void reportHandshakeResult(int32_t bytesTransferred, bool wasReading,
break;
}
Telemetry::Accumulate(Telemetry::SSL_HANDSHAKE_RESULT, bucket);
if (bucket == 0) {
// Web Privacy Telemetry for successful connections.
// Discard errors from these function calls in release.
bool success = true;
bool usedPrivateDNS = false;
success &= socketInfo->GetUsedPrivateDNS(&usedPrivateDNS) == NS_OK;
MOZ_ASSERT(success, "Transport Security Getters should not fail.");
bool madeOCSPRequest = false;
success &= socketInfo->GetMadeOCSPRequests(&madeOCSPRequest) == NS_OK;
MOZ_ASSERT(success, "Transport Security Getters should not fail.");
uint16_t protocolVersion = 0;
success &= socketInfo->GetProtocolVersion(&protocolVersion) == NS_OK;
MOZ_ASSERT(success, "Transport Security Getters should not fail.");
bool usedTLS13 = protocolVersion == 4;
bool usedECH = false;
success &= socketInfo->GetIsAcceptedEch(&usedECH) == NS_OK;
MOZ_ASSERT(success, "Transport Security Getters should not fail.");
if (success) {
uint8_t TLSPrivacyResult = 0;
TLSPrivacyResult |= usedTLS13 << 0;
TLSPrivacyResult |= !madeOCSPRequest << 1;
TLSPrivacyResult |= usedPrivateDNS << 2;
TLSPrivacyResult |= usedECH << 3;
Telemetry::Accumulate(Telemetry::SSL_HANDSHAKE_PRIVACY, TLSPrivacyResult);
}
}
}
int32_t checkHandshake(int32_t bytesTransfered, bool wasReading,

Просмотреть файл

@ -3120,6 +3120,17 @@
"n_values": 16,
"description": "Negotiated SSL Version (1=tls1, 2=tls1.1, 3=tls1.2, 4=tls1.3)"
},
"SSL_HANDSHAKE_PRIVACY": {
"record_in_processes": ["main", "socket"],
"products": ["firefox", "fennec"],
"alert_emails": ["seceng-telemetry@mozilla.com"],
"bug_numbers": [1788290],
"releaseChannelCollection": "opt-out",
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 16,
"description": "0th bit - TLS13 used? 1th bit - Revocation Privacy, 2nd bit - DNS Privacy, 3rd bit - ECH Privacy"
},
"SSL_HANDSHAKE_RESULT": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],