File: service_provider_config.cc

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (155 lines) | stat: -rw-r--r-- 5,309 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/enterprise/connectors/core/service_provider_config.h"

#include <array>
#include <iterator>
#include <string_view>

#include "base/json/json_reader.h"

namespace enterprise_connectors {

namespace {

constexpr std::array<SupportedTag, 2> kGoogleDlpSupportedTags = {{
    {
        .name = "malware",
        .display_name = "Threat protection",
        .max_file_size = 52428800,
    },
    {
        .name = "dlp",
        .display_name = "Sensitive data protection",
        .max_file_size = 52428800,
    },
}};

constexpr std::array<const char*, 3> kGoogleDlpRegionalizedUrls = {
    // LINT.IfChange(DlpRegionEndpoints)
    {"https://safebrowsing.google.com/safebrowsing/uploads/scan",
     "https://scan.webprotect-us.goog/uploads",
     "https://scan.webprotect-eu.goog/uploads"}
    // LINT.ThenChange(/components/enterprise/connectors/core/common.h:DataRegion)
};

constexpr AnalysisConfig kGoogleAnalysisConfig = {
    .url = "https://safebrowsing.google.com/safebrowsing/uploads/scan",
    .supported_tags = base::span<const SupportedTag>(kGoogleDlpSupportedTags),
    .region_urls = base::span<const char* const>(kGoogleDlpRegionalizedUrls),
};

constexpr std::array<SupportedTag, 1> kLocalTestSupportedTags = {{
    {
        .name = "dlp",
        .display_name = "Sensitive data protection",
        .max_file_size = 52428800,
    },
}};

constexpr std::array<SupportedTag, 1> kBrcmChrmCasSupportedTags = {{
    {
        .name = "dlp",
        .display_name = "Sensitive data protection",
        .max_file_size = 52428800,
    },
}};

constexpr std::array<SupportedTag, 1> kTrellixSupportedTags = {{
    {
        .name = "dlp",
        .display_name = "Sensitive data protection",
        .max_file_size = 52428800,
    },
}};

constexpr AnalysisConfig kLocalTestUserAnalysisConfig = {
    .local_path = "path_user",
    .supported_tags = base::span<const SupportedTag>(kLocalTestSupportedTags),
    .user_specific = true,
};

constexpr AnalysisConfig kBrcmChrmCasAnalysisConfig = {
    .local_path = "brcm_chrm_cas",
    .supported_tags = base::span<const SupportedTag>(kBrcmChrmCasSupportedTags),
    .user_specific = false,
};

constexpr std::array<const char*, 2> kTrellixSubjectNames = {
    {"MUSARUBRA US LLC", "Musarubra US LLC"}};

constexpr AnalysisConfig kTrellixAnalysisConfig = {
    .local_path = "Trellix_DLP",
    .supported_tags = base::span<const SupportedTag>(kTrellixSupportedTags),
    .user_specific = true,
    .subject_names = base::span<const char* const>(kTrellixSubjectNames),
};

constexpr ReportingConfig kGoogleReportingConfig = {
    .url = "https://chromereporting-pa.googleapis.com/v1/events",
};

}  // namespace

const ServiceProviderConfig* GetServiceProviderConfig() {
  // The policy schema validates that the provider name is an expected value, so
  // when one is added to this dictionary it also needs to be added to the
  // corresponding policy definitions.
  // LINT.IfChange
  static constexpr ServiceProviderConfig kServiceProviderConfig =
      base::MakeFixedFlatMap<std::string_view, ServiceProvider>({
          {
              "google",
              {
                  .display_name = "Google Cloud",
                  .analysis = &kGoogleAnalysisConfig,
                  .reporting = &kGoogleReportingConfig,
              },
          },
          // TODO(b/226560946): Add the actual local content analysis service
          // providers to this config.
          {
              "local_user_agent",
              {
                  .display_name = "Test user agent",
                  .analysis = &kLocalTestUserAnalysisConfig,
              },
          },
          // Temporary code(b/268532118): Once DM server no longer sends
          // this value as a service_provider name, this block can be
          // removed.
          {
              "local_system_agent",
              {
                  .display_name = "Test system agent",
                  .analysis = &kBrcmChrmCasAnalysisConfig,
              },
          },
          {
              "brcm_chrm_cas",
              {
                  .display_name = "Broadcom Inc",
                  .analysis = &kBrcmChrmCasAnalysisConfig,
              },
          },
          {
              "trellix",
              {
                  .display_name = "Trellix DLP Endpoint",
                  .analysis = &kTrellixAnalysisConfig,
              },
          },
      });
  // LINT.ThenChange(//components/policy/resources/templates/policy_definitions/Miscellaneous)
  // The following policies should have their service_provider entries updated:
  //   //components/policy/resources/templates/policy_definitions/Miscellaneous/OnBulkDataEntryEnterpriseConnector.yaml,
  //   //components/policy/resources/templates/policy_definitions/Miscellaneous/OnFileAttachedEnterpriseConnector.yaml,
  //   //components/policy/resources/templates/policy_definitions/Miscellaneous/OnFileDownloadedEnterpriseConnector.yaml,
  //   //components/policy/resources/templates/policy_definitions/Miscellaneous/OnPrintEnterpriseConnector.yaml
  // )
  return &kServiceProviderConfig;
}

}  // namespace enterprise_connectors