Commit 97adba47 authored by Sergey Poromov's avatar Sergey Poromov Committed by Chromium LUCI CQ

DLP: Add logging.

Until proper DLP reporting is ready we need to log when
DLP blocks some user action to provide more transparency
for the admins.

Bug: 1166600
Change-Id: Iff4ae86bd3c172266723ef7e88290fa1fa47c386
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628291Reviewed-by: default avatarAya Elsayed <ayaelattar@chromium.org>
Commit-Queue: Sergey Poromov <poromov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843505}
parent 4d7c834b
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.h" #include "chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.h"
#include "base/notreached.h" #include "base/notreached.h"
#include "base/syslog_logging.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
...@@ -119,6 +120,7 @@ bool DataTransferDlpController::IsClipboardReadAllowed( ...@@ -119,6 +120,7 @@ bool DataTransferDlpController::IsClipboardReadAllowed(
notify_on_paste = false; notify_on_paste = false;
if (level == DlpRulesManager::Level::kBlock && notify_on_paste) { if (level == DlpRulesManager::Level::kBlock && notify_on_paste) {
SYSLOG(INFO) << "DLP blocked paste from clipboard";
DoNotifyBlockedPaste(data_src, data_dst); DoNotifyBlockedPaste(data_src, data_dst);
} }
...@@ -133,6 +135,7 @@ bool DataTransferDlpController::IsDragDropAllowed( ...@@ -133,6 +135,7 @@ bool DataTransferDlpController::IsDragDropAllowed(
IsDataTransferAllowed(dlp_rules_manager_, data_src, data_dst); IsDataTransferAllowed(dlp_rules_manager_, data_src, data_dst);
if (level == DlpRulesManager::Level::kBlock && is_drop) { if (level == DlpRulesManager::Level::kBlock && is_drop) {
SYSLOG(INFO) << "DLP blocked drop of dragged data";
DoNotifyBlockedPaste(data_src, data_dst); DoNotifyBlockedPaste(data_src, data_dst);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/containers/contains.h" #include "base/containers/contains.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/syslog_logging.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_notification_helper.h" #include "chrome/browser/chromeos/policy/dlp/dlp_notification_helper.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h"
...@@ -62,12 +63,20 @@ DlpContentRestrictionSet DlpContentManager::GetOnScreenPresentRestrictions() ...@@ -62,12 +63,20 @@ DlpContentRestrictionSet DlpContentManager::GetOnScreenPresentRestrictions()
bool DlpContentManager::IsScreenshotRestricted( bool DlpContentManager::IsScreenshotRestricted(
const ScreenshotArea& area) const { const ScreenshotArea& area) const {
return IsAreaRestricted(area, DlpContentRestriction::kScreenshot); const bool restricted =
IsAreaRestricted(area, DlpContentRestriction::kScreenshot);
if (restricted)
SYSLOG(INFO) << "DLP blocked taking a screenshot";
return restricted;
} }
bool DlpContentManager::IsVideoCaptureRestricted( bool DlpContentManager::IsVideoCaptureRestricted(
const ScreenshotArea& area) const { const ScreenshotArea& area) const {
return IsAreaRestricted(area, DlpContentRestriction::kVideoCapture); const bool restricted =
IsAreaRestricted(area, DlpContentRestriction::kVideoCapture);
if (restricted)
SYSLOG(INFO) << "DLP blocked taking a video capture";
return restricted;
} }
bool DlpContentManager::IsPrintingRestricted( bool DlpContentManager::IsPrintingRestricted(
...@@ -79,15 +88,21 @@ bool DlpContentManager::IsPrintingRestricted( ...@@ -79,15 +88,21 @@ bool DlpContentManager::IsPrintingRestricted(
web_contents = web_contents =
guest_view ? guest_view->embedder_web_contents() : web_contents; guest_view ? guest_view->embedder_web_contents() : web_contents;
return GetConfidentialRestrictions(web_contents) const bool restricted = GetConfidentialRestrictions(web_contents)
.HasRestriction(DlpContentRestriction::kPrint); .HasRestriction(DlpContentRestriction::kPrint);
if (restricted)
SYSLOG(INFO) << "DLP blocked printing";
return restricted;
} }
bool DlpContentManager::IsScreenCaptureRestricted( bool DlpContentManager::IsScreenCaptureRestricted(
const content::DesktopMediaID& media_id) const { const content::DesktopMediaID& media_id) const {
if (media_id.type == content::DesktopMediaID::Type::TYPE_SCREEN) { if (media_id.type == content::DesktopMediaID::Type::TYPE_SCREEN) {
return GetOnScreenPresentRestrictions().HasRestriction( const bool restricted = GetOnScreenPresentRestrictions().HasRestriction(
DlpContentRestriction::kScreenShare); DlpContentRestriction::kScreenShare);
if (restricted)
SYSLOG(INFO) << "DLP blocked screen sharing";
return restricted;
} }
content::WebContents* web_contents = content::WebContents* web_contents =
...@@ -97,8 +112,12 @@ bool DlpContentManager::IsScreenCaptureRestricted( ...@@ -97,8 +112,12 @@ bool DlpContentManager::IsScreenCaptureRestricted(
media_id.web_contents_id.main_render_frame_id)); media_id.web_contents_id.main_render_frame_id));
if (media_id.type == content::DesktopMediaID::Type::TYPE_WEB_CONTENTS) { if (media_id.type == content::DesktopMediaID::Type::TYPE_WEB_CONTENTS) {
return GetConfidentialRestrictions(web_contents) const bool restricted =
.HasRestriction(DlpContentRestriction::kScreenShare); GetConfidentialRestrictions(web_contents)
.HasRestriction(DlpContentRestriction::kScreenShare);
if (restricted)
SYSLOG(INFO) << "DLP blocked screen sharing";
return restricted;
} }
DCHECK_EQ(media_id.type, content::DesktopMediaID::Type::TYPE_WINDOW); DCHECK_EQ(media_id.type, content::DesktopMediaID::Type::TYPE_WINDOW);
...@@ -110,6 +129,7 @@ bool DlpContentManager::IsScreenCaptureRestricted( ...@@ -110,6 +129,7 @@ bool DlpContentManager::IsScreenCaptureRestricted(
aura::Window* web_contents_window = entry.first->GetNativeView(); aura::Window* web_contents_window = entry.first->GetNativeView();
if (entry.second.HasRestriction(DlpContentRestriction::kScreenShare) && if (entry.second.HasRestriction(DlpContentRestriction::kScreenShare) &&
window->Contains(web_contents_window)) { window->Contains(web_contents_window)) {
SYSLOG(INFO) << "DLP blocked screen sharing";
return true; return true;
} }
} }
...@@ -132,10 +152,13 @@ void DlpContentManager::OnVideoCaptureStopped() { ...@@ -132,10 +152,13 @@ void DlpContentManager::OnVideoCaptureStopped() {
} }
bool DlpContentManager::IsCaptureModeInitRestricted() const { bool DlpContentManager::IsCaptureModeInitRestricted() const {
return GetOnScreenPresentRestrictions().HasRestriction( const bool restricted = GetOnScreenPresentRestrictions().HasRestriction(
DlpContentRestriction::kScreenshot) || DlpContentRestriction::kScreenshot) ||
GetOnScreenPresentRestrictions().HasRestriction( GetOnScreenPresentRestrictions().HasRestriction(
DlpContentRestriction::kVideoCapture); DlpContentRestriction::kVideoCapture);
if (restricted)
SYSLOG(INFO) << "DLP blocked taking a screen capture";
return restricted;
} }
void DlpContentManager::OnScreenCaptureStarted( void DlpContentManager::OnScreenCaptureStarted(
...@@ -307,6 +330,7 @@ void DlpContentManager::OnScreenRestrictionsChanged( ...@@ -307,6 +330,7 @@ void DlpContentManager::OnScreenRestrictionsChanged(
DlpContentRestriction::kPrivacyScreen))); DlpContentRestriction::kPrivacyScreen)));
if (added_restrictions.HasRestriction( if (added_restrictions.HasRestriction(
DlpContentRestriction::kPrivacyScreen)) { DlpContentRestriction::kPrivacyScreen)) {
SYSLOG(INFO) << "DLP enforced privacy screen";
ash::PrivacyScreenDlpHelper::Get()->SetEnforced(true); ash::PrivacyScreenDlpHelper::Get()->SetEnforced(true);
} }
...@@ -323,6 +347,7 @@ void DlpContentManager::OnScreenRestrictionsChanged( ...@@ -323,6 +347,7 @@ void DlpContentManager::OnScreenRestrictionsChanged(
void DlpContentManager::MaybeRemovePrivacyScreenEnforcement() const { void DlpContentManager::MaybeRemovePrivacyScreenEnforcement() const {
if (!GetOnScreenPresentRestrictions().HasRestriction( if (!GetOnScreenPresentRestrictions().HasRestriction(
DlpContentRestriction::kPrivacyScreen)) { DlpContentRestriction::kPrivacyScreen)) {
SYSLOG(INFO) << "DLP removed enforcement of privacy screen";
ash::PrivacyScreenDlpHelper::Get()->SetEnforced(false); ash::PrivacyScreenDlpHelper::Get()->SetEnforced(false);
} }
} }
...@@ -387,8 +412,10 @@ void DlpContentManager::CheckRunningVideoCapture() { ...@@ -387,8 +412,10 @@ void DlpContentManager::CheckRunningVideoCapture() {
return; return;
if (IsAreaRestricted(*running_video_capture_area_, if (IsAreaRestricted(*running_video_capture_area_,
DlpContentRestriction::kVideoCapture)) { DlpContentRestriction::kVideoCapture)) {
if (ash::features::IsCaptureModeEnabled()) if (ash::features::IsCaptureModeEnabled()) {
SYSLOG(INFO) << "DLP interrupted screen recording";
ChromeCaptureModeDelegate::Get()->InterruptVideoRecordingIfAny(); ChromeCaptureModeDelegate::Get()->InterruptVideoRecordingIfAny();
}
running_video_capture_area_.reset(); running_video_capture_area_.reset();
} }
} }
...@@ -428,6 +455,8 @@ void DlpContentManager::CheckRunningScreenCaptures() { ...@@ -428,6 +455,8 @@ void DlpContentManager::CheckRunningScreenCaptures() {
for (auto& capture : running_screen_captures_) { for (auto& capture : running_screen_captures_) {
bool is_allowed = !IsScreenCaptureRestricted(capture.media_id); bool is_allowed = !IsScreenCaptureRestricted(capture.media_id);
if (is_allowed != capture.is_running) { if (is_allowed != capture.is_running) {
SYSLOG(INFO) << "DLP " << (is_allowed ? "resumed" : "paused")
<< " running screen share";
capture.state_change_callback.Run( capture.state_change_callback.Run(
capture.media_id, capture.is_running capture.media_id, capture.is_running
? blink::mojom::MediaStreamStateChange::PAUSE ? blink::mojom::MediaStreamStateChange::PAUSE
......
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