| Index: components/sync/engine_impl/commit.cc
|
| diff --git a/components/sync/engine_impl/commit.cc b/components/sync/engine_impl/commit.cc
|
| index f8d9bf55c5418401f68f26c2cb8ef9ae6f9562b8..e6df7844ca11c8b73b79c201703778d1fc8a52fa 100644
|
| --- a/components/sync/engine_impl/commit.cc
|
| +++ b/components/sync/engine_impl/commit.cc
|
| @@ -6,11 +6,14 @@
|
|
|
| #include <utility>
|
|
|
| +#include "base/feature_list.h"
|
| #include "base/metrics/histogram_macros.h"
|
| +#include "base/rand_util.h"
|
| #include "base/trace_event/trace_event.h"
|
| #include "components/sync/base/data_type_histogram.h"
|
| #include "components/sync/engine/events/commit_request_event.h"
|
| #include "components/sync/engine/events/commit_response_event.h"
|
| +#include "components/sync/engine/net/http_bridge.h"
|
| #include "components/sync/engine_impl/commit_processor.h"
|
| #include "components/sync/engine_impl/commit_util.h"
|
| #include "components/sync/engine_impl/cycle/sync_cycle.h"
|
| @@ -19,6 +22,13 @@
|
|
|
| namespace syncer {
|
|
|
| +namespace {
|
| +// The number of random ASCII bytes we'll add to CommitMessage. We choose 256
|
| +// because it is not too large (to hurt performance and compression ratio), but
|
| +// it is not too small to easily be canceled out using statistical analysis.
|
| +const size_t kPaddingSize = 256;
|
| +}
|
| +
|
| Commit::Commit(ContributionMap contributions,
|
| const sync_pb::ClientToServerMessage& message,
|
| ExtensionsActivity::Records extensions_activity_buffer)
|
| @@ -57,6 +67,11 @@ Commit* Commit::Init(ModelTypeSet requested_types,
|
| sync_pb::CommitMessage* commit_message = message.mutable_commit();
|
| commit_message->set_cache_guid(cache_guid);
|
|
|
| + // Set padding to mitigate CRIME attack.
|
| + if (base::FeatureList::IsEnabled(syncer::kSyncClientToServerCompression)) {
|
| + commit_message->set_padding(base::RandBytesAsString(kPaddingSize));
|
| + }
|
| +
|
| // Set extensions activity if bookmark commits are present.
|
| ExtensionsActivity::Records extensions_activity_buffer;
|
| ContributionMap::const_iterator it = contributions.find(BOOKMARKS);
|
|
|