-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show system tray privacy warning if XDR reporting is enabled
If the DeviceReportXDREvents policy is enabled, show a privacy warning notifying the user that network traffic may be monitored. If DNS or the XDR policy is enabled the enterprise symbol will be used. Merge the 2 cases into 1 bool "enterprise_monitored_web_requests". Move from network state properties to global property. and not shown when disabled. Bug: b/283268889 Test: Verified that warning was shown when XDR policy is enabled Change-Id: Iad1012388ef134d5a10cb50f7a9c47b1bdbf583e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4575915 Commit-Queue: Ryan Borzello <rborzello@google.com> Auto-Submit: Ryan Borzello <rborzello@google.com> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Cr-Commit-Position: refs/heads/main@{#1154001}
- Loading branch information
Ryan Borzello
authored and
Chromium LUCI CQ
committed
Jun 6, 2023
1 parent
7d6e0c0
commit 5e476d2
Showing
26 changed files
with
318 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/ash/net/xdr_manager.h" | ||
|
||
#include <memory> | ||
|
||
#include "base/logging.h" | ||
#include "base/values.h" | ||
#include "chromeos/ash/components/network/network_handler.h" | ||
#include "chromeos/ash/components/network/network_metadata_store.h" | ||
#include "components/policy/policy_constants.h" | ||
|
||
namespace ash { | ||
|
||
XdrManager::XdrManager(policy::PolicyService* policy_service) { | ||
// Register callback for when DeviceReportXDREvents changes. | ||
policy_registrar_ = std::make_unique<policy::PolicyChangeRegistrar>( | ||
policy_service, | ||
policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())); | ||
policy_registrar_->Observe(policy::key::kDeviceReportXDREvents, | ||
base::BindRepeating(&XdrManager::OnXdrPolicyChange, | ||
base::Unretained(this))); | ||
// Get and set initial XDR policy. | ||
auto* report_xdr_events_value = | ||
policy_service | ||
->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | ||
std::string())) | ||
.GetValue(policy::key::kDeviceReportXDREvents, | ||
base::Value::Type::BOOLEAN); | ||
report_xdr_events_enabled_ = | ||
report_xdr_events_value && report_xdr_events_value->GetBool(); | ||
|
||
SetNetworkMetadataStoreXdrValue(); | ||
} | ||
|
||
XdrManager::~XdrManager() = default; | ||
|
||
bool XdrManager::AreXdrPoliciesEnabled() { | ||
return report_xdr_events_enabled_; | ||
} | ||
|
||
void XdrManager::OnXdrPolicyChange(const base::Value* previous, | ||
const base::Value* current) { | ||
report_xdr_events_enabled_ = current && current->GetBool(); | ||
|
||
SetNetworkMetadataStoreXdrValue(); | ||
} | ||
|
||
void XdrManager::SetNetworkMetadataStoreXdrValue() { | ||
NetworkHandler::Get()->network_metadata_store()->SetReportXdrEventsEnabled( | ||
report_xdr_events_enabled_); | ||
} | ||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_ASH_NET_XDR_MANAGER_H_ | ||
#define CHROME_BROWSER_ASH_NET_XDR_MANAGER_H_ | ||
|
||
#include "components/policy/core/common/policy_namespace.h" | ||
#include "components/policy/core/common/policy_service.h" | ||
|
||
namespace ash { | ||
|
||
// Responds to changes in the DeviceReportXDREvents policy and updates | ||
// the network metadata to determine if connection warning should be shown. | ||
class XdrManager { | ||
public: | ||
explicit XdrManager(policy::PolicyService* policy_service); | ||
XdrManager(const XdrManager&) = delete; | ||
XdrManager& operator=(const XdrManager&) = delete; | ||
~XdrManager(); | ||
|
||
// Returns whether or not XDR events are being reported. | ||
bool AreXdrPoliciesEnabled(); | ||
|
||
private: | ||
// Updates the network metadata store value when the XDR policy changes. | ||
void OnXdrPolicyChange(const base::Value* previous, | ||
const base::Value* current); | ||
// Sets the current value of the XDR policy in network metadata store. | ||
void SetNetworkMetadataStoreXdrValue(); | ||
|
||
std::unique_ptr<policy::PolicyChangeRegistrar> policy_registrar_; | ||
bool report_xdr_events_enabled_ = false; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // CHROME_BROWSER_ASH_NET_XDR_MANAGER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.