Commit 35565a5d authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Add traffic annotation to SocketBIOAdapter.

Local network traffic annotation is to the socket write function in
ScoketBIOAdapter.

Bug: 656607
Change-Id: Id2008b1f877db80e006c1be3c31936f890189913
Reviewed-on: https://chromium-review.googlesource.com/873270
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533659}
parent 71135db5
...@@ -18,8 +18,42 @@ ...@@ -18,8 +18,42 @@
#include "net/socket/socket.h" #include "net/socket/socket.h"
#include "net/socket/stream_socket.h" #include "net/socket/stream_socket.h"
#include "net/ssl/openssl_ssl_util.h" #include "net/ssl/openssl_ssl_util.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "third_party/boringssl/src/include/openssl/bio.h" #include "third_party/boringssl/src/include/openssl/bio.h"
namespace {
net::NetworkTrafficAnnotationTag kTrafficAnnotation =
net::DefineNetworkTrafficAnnotation("socket_bio_adapter", R"(
semantics {
sender: "Socket BIO Adapter"
description:
"SocketBIOAdapter is used only internal to //net code as an internal "
"detail to implement a TLS connection for a Socket class, and is not "
"being called directly outside of this abstraction."
trigger:
"Establishing a TLS connection to a remote endpoint. There are many "
"different ways in which a TLS connection may be triggered, such as "
"loading an HTTPS URL."
data:
"All data sent or received over a TLS connection. This traffic may "
"either be the handshake or application data. During the handshake, "
"the target host name, user's IP, data related to previous "
"handshake, client certificates, and channel ID, may be sent. When "
"the connection is used to load an HTTPS URL, the application data "
"includes cookies, request headers, and the response body."
destination: OTHER
destination_other:
"Any destination the implementing socket is connected to."
}
policy {
cookies_allowed: NO
setting: "This feature cannot be disabled."
policy_exception_justification: "Essential for navigation."
})");
} // namespace
namespace net { namespace net {
SocketBIOAdapter::SocketBIOAdapter(StreamSocket* socket, SocketBIOAdapter::SocketBIOAdapter(StreamSocket* socket,
...@@ -247,8 +281,8 @@ void SocketBIOAdapter::SocketWrite() { ...@@ -247,8 +281,8 @@ void SocketBIOAdapter::SocketWrite() {
while (write_error_ == OK && write_buffer_used_ > 0) { while (write_error_ == OK && write_buffer_used_ > 0) {
int write_size = int write_size =
std::min(write_buffer_used_, write_buffer_->RemainingCapacity()); std::min(write_buffer_used_, write_buffer_->RemainingCapacity());
int result = int result = socket_->Write(write_buffer_.get(), write_size,
socket_->Write(write_buffer_.get(), write_size, write_callback_); write_callback_, kTrafficAnnotation);
if (result == ERR_IO_PENDING) { if (result == ERR_IO_PENDING) {
write_error_ = ERR_IO_PENDING; write_error_ = ERR_IO_PENDING;
return; return;
......
...@@ -43449,6 +43449,7 @@ Full version information for the fingerprint enum values: ...@@ -43449,6 +43449,7 @@ Full version information for the fingerprint enum values:
Called by update_traffic_annotation_histograms.py.--> Called by update_traffic_annotation_histograms.py.-->
<int value="485305" label="data_reduction_proxy_config"/> <int value="485305" label="data_reduction_proxy_config"/>
<int value="516551" label="socket_bio_adapter"/>
<int value="727478" label="metrics_report_ukm"/> <int value="727478" label="metrics_report_ukm"/>
<int value="727528" label="metrics_report_uma"/> <int value="727528" label="metrics_report_uma"/>
<int value="1112842" label="oauth2_mint_token_flow"/> <int value="1112842" label="oauth2_mint_token_flow"/>
...@@ -196,6 +196,7 @@ Refer to README.md for content description and update process. ...@@ -196,6 +196,7 @@ Refer to README.md for content description and update process.
<item id="service_worker_navigation_preload" hash_code="129872904" type="0" content_hash_code="79473248" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc"/> <item id="service_worker_navigation_preload" hash_code="129872904" type="0" content_hash_code="79473248" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc"/>
<item id="service_worker_write_to_cache_job" hash_code="117963307" type="0" content_hash_code="18065724" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_write_to_cache_job.cc"/> <item id="service_worker_write_to_cache_job" hash_code="117963307" type="0" content_hash_code="18065724" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_write_to_cache_job.cc"/>
<item id="signed_in_profile_avatar" hash_code="108903331" type="0" content_hash_code="72850619" os_list="linux,windows" file_path="chrome/browser/profiles/profile_downloader.cc"/> <item id="signed_in_profile_avatar" hash_code="108903331" type="0" content_hash_code="72850619" os_list="linux,windows" file_path="chrome/browser/profiles/profile_downloader.cc"/>
<item id="socket_bio_adapter" hash_code="516551" type="0" content_hash_code="21643352" os_list="linux,windows" file_path="net/socket/socket_bio_adapter.cc"/>
<item id="speech_recognition_downstream" hash_code="26096088" type="0" content_hash_code="120733233" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/> <item id="speech_recognition_downstream" hash_code="26096088" type="0" content_hash_code="120733233" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/>
<item id="speech_recognition_upstream" hash_code="66846958" type="0" content_hash_code="7706219" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/> <item id="speech_recognition_upstream" hash_code="66846958" type="0" content_hash_code="7706219" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/>
<item id="spellcheck_hunspell_dictionary" hash_code="117649486" type="0" content_hash_code="45660952" os_list="linux,windows" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc"/> <item id="spellcheck_hunspell_dictionary" hash_code="117649486" type="0" content_hash_code="45660952" os_list="linux,windows" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment