tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

analysis.proto (8366B)


      1 // Copyright 2022 The Chromium Authors.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 syntax = "proto2";
      6 
      7 option optimize_for = LITE_RUNTIME;
      8 
      9 package content_analysis.sdk;
     10 
     11 // The values in this enum can be extended in future versions of Chrome to
     12 // support new analysis triggers.
     13 enum AnalysisConnector {
     14  ANALYSIS_CONNECTOR_UNSPECIFIED = 0;
     15  FILE_DOWNLOADED = 1;
     16  FILE_ATTACHED = 2;
     17  BULK_DATA_ENTRY = 3;
     18  PRINT = 4;
     19  // This value is not yet implemented in the SDK. It is kept for consistency with the Chromium code.
     20  FILE_TRANSFER = 5;
     21 }
     22 
     23 message ContentMetaData {
     24  // The URL containing the file download/upload or to which web content is
     25  // being uploaded.
     26  optional string url = 1;
     27 
     28  // Name of file on user system (if applicable).
     29  optional string filename = 2;
     30 
     31  // Sha256 digest of file.
     32  optional string digest = 3;
     33 
     34  // Specifically for the download case.
     35  optional ClientDownloadRequest csd = 4;
     36 
     37  // Optional email address of user.  This field may be empty if the user
     38  // is not signed in.
     39  optional string email = 5;
     40 
     41  // Name of tab title.
     42  optional string tab_title = 9;
     43 
     44  // Empty for non-print actions.
     45  message PrintMetadata {
     46    optional string printer_name = 1;
     47 
     48    enum PrinterType {
     49      UNKNOWN = 0;
     50      CLOUD = 1;
     51      LOCAL = 2;
     52    }
     53    optional PrinterType printer_type = 2;
     54  }
     55  optional PrintMetadata print_metadata = 11;
     56 
     57  reserved 6 to 8, 10;
     58 }
     59 
     60 message ClientMetadata {
     61  // Describes the browser uploading a scan request.
     62  message Browser {
     63    // This is omitted on scans triggered at the profile level.
     64    optional string machine_user = 4;
     65 
     66    reserved 1 to 3;
     67  };
     68  optional Browser browser = 1;
     69 
     70  reserved 2 to 3;
     71 };
     72 
     73 message ClientDownloadRequest {
     74  // Type of the resources stored below.
     75  enum ResourceType {
     76    // The final URL of the download payload.  The resource URL should
     77    // correspond to the URL field above.
     78    DOWNLOAD_URL = 0;
     79    // A redirect URL that was fetched before hitting the final DOWNLOAD_URL.
     80    DOWNLOAD_REDIRECT = 1;
     81    // The final top-level URL of the tab that triggered the download.
     82    TAB_URL = 2;
     83    // A redirect URL thas was fetched before hitting the final TAB_URL.
     84    TAB_REDIRECT = 3;
     85    // The document URL for a PPAPI plugin instance that initiated the download.
     86    // This is the document.url for the container element for the plugin
     87    // instance.
     88    PPAPI_DOCUMENT = 4;
     89    // The plugin URL for a PPAPI plugin instance that initiated the download.
     90    PPAPI_PLUGIN = 5;
     91  }
     92 
     93  message Resource {
     94    required string url = 1;
     95    required ResourceType type = 2;
     96 
     97    reserved 3 to 4;
     98  }
     99 
    100  repeated Resource resources = 4;
    101 
    102  reserved 1 to 3, 5 to 84;
    103 }
    104 
    105 
    106 // Analysis request sent from chrome to backend.
    107 // The proto in the Chromium codebase is the source of truth, the version here
    108 // should always be in sync with it (https://osscs.corp.google.com/chromium/chromium/src/+/main:components/enterprise/common/proto/connectors.proto;l=87;drc=a8fb6888aff535f27654f03cd1643868ba066de9).
    109 message ContentAnalysisRequest {
    110  // Token used to correlate requests and responses. This is different than the
    111  // FCM token in that it is unique for each request.
    112  optional string request_token = 5;
    113 
    114  // Which enterprise connector fired this request.
    115  optional AnalysisConnector analysis_connector = 9;
    116 
    117  // Information about the data that triggered the content analysis request.
    118  optional ContentMetaData request_data = 10;
    119 
    120  // The tags configured for the URL that triggered the content analysis.
    121  repeated string tags = 11;
    122 
    123  // Additional information about the browser, device or profile so events can
    124  // be reported with device/user identifiable information.
    125  optional ClientMetadata client_metadata = 12;
    126 
    127  // Data used to transmit print data from the browser.
    128  message PrintData {
    129    // A platform-specific handle that can be used to access the printed document.
    130    optional int64 handle = 1;
    131 
    132    // The size of the data to be printed.
    133    optional int64 size = 2;
    134  }
    135 
    136  oneof content_data {
    137    // The text content to analyze in local content analysis request.
    138    string text_content = 13;
    139 
    140    // The full path to the file to analyze in local content analysis request.
    141    // The path is expressed in a platform dependent way.
    142    string file_path = 14;
    143 
    144    // The to-be-printed page/document in PDF format.
    145    PrintData print_data = 18;
    146  }
    147 
    148  // The absolute deadline (seconds since the UTC Epoch time) that Chrome will
    149  // wait until a response from the agent is received.
    150  optional int64 expires_at = 15;
    151 
    152  // ID for keeping track of analysis requests that belong to the same user
    153  // action.
    154  optional string user_action_id = 16;
    155 
    156  // Count of analysis requests that belong to the same user action.
    157  optional int64 user_action_requests_count = 17;
    158 
    159  // Indicates the exact reason the request was created, ie which user action
    160  // led to a data transfer.
    161  enum Reason {
    162    UNKNOWN = 0;
    163 
    164    // Only possible for the `FILE_ATTACHED` and `BULK_DATA_ENTRY` actions.
    165    CLIPBOARD_PASTE = 1;
    166    DRAG_AND_DROP = 2;
    167 
    168    // Only possible for the `FILE_ATTACHED` action.
    169    FILE_PICKER_DIALOG = 3;
    170 
    171    // Only possible for the `PRINT` analysis connector.
    172    PRINT_PREVIEW_PRINT = 4;
    173    SYSTEM_DIALOG_PRINT = 5;
    174 
    175    // Only possible for the `FILE_DOWNLOADED` analysis connector.
    176    NORMAL_DOWNLOAD = 6;
    177    SAVE_AS_DOWNLOAD = 7;
    178  }
    179  optional Reason reason = 19;
    180 
    181  // Reserved to make sure there is no overlap with DeepScanningClientRequest.
    182  reserved 1 to 4, 6 to 8, 20;
    183 }
    184 
    185 // Verdict response sent from agent to Google Chrome.
    186 message ContentAnalysisResponse {
    187  // Token used to correlate requests and responses. Corresponds to field in
    188  // ContentAnalysisRequest with the same name.
    189  optional string request_token = 1;
    190 
    191  // Represents the analysis result from a given tag.
    192  message Result {
    193    optional string tag = 1;
    194 
    195    // The status of this result.
    196    enum Status {
    197      STATUS_UNKNOWN = 0;
    198      SUCCESS = 1;
    199      FAILURE = 2;
    200    }
    201    optional Status status = 2;
    202 
    203    // Identifies the detection rules that were triggered by the analysis.
    204    // Only relevant when status is SUCCESS.
    205    message TriggeredRule {
    206      enum Action {
    207        ACTION_UNSPECIFIED = 0;
    208        REPORT_ONLY = 1;
    209        WARN = 2;
    210        BLOCK = 3;
    211      }
    212      optional Action action = 1;
    213      optional string rule_name = 2;
    214      optional string rule_id = 3;
    215      reserved 4;
    216    }
    217    repeated TriggeredRule triggered_rules = 3;
    218 
    219    reserved 4 to 7;
    220  }
    221  repeated Result results = 4;
    222 
    223  reserved 2 to 3;
    224 }
    225 
    226 // An Acknowledgement is sent by the browser following the receipt of a response
    227 // from the agent.
    228 message ContentAnalysisAcknowledgement {
    229  // Token used to correlate with the corresponding request and response.
    230  optional string request_token = 1;
    231 
    232  // The action taken by google Chrome with the content analysis response.
    233  enum Status {
    234    // The response was handled as specified by the agent.
    235    SUCCESS = 1;
    236 
    237    // The response from the agent was not properly formatted.
    238    INVALID_RESPONSE = 2;
    239 
    240    // The response from the agent was too late and Google Chrome took the
    241    // default action.
    242    TOO_LATE = 3;
    243  };
    244  optional Status status = 2;
    245 
    246  // The final action that chrome took with this request.  This may be different
    247  // from the action specified in the response if the response was too late or
    248  // if the original request was part of a user action whose overall final
    249  // differed from the action of this particular request.
    250  enum FinalAction {
    251    ACTION_UNSPECIFIED = 0;
    252    ALLOW = 1;
    253    REPORT_ONLY = 2;
    254    WARN = 3;
    255    BLOCK = 4;
    256  };
    257  optional FinalAction final_action = 3;
    258 }
    259 
    260 // A message that asks the agent to cancel all requests with the given user
    261 // action id.  Note that more that content analysis request may have the given
    262 // user action id.
    263 message ContentAnalysisCancelRequests {
    264  optional string user_action_id = 1;
    265 }
    266 
    267 // Generic message sent from Chrome to Agent.
    268 message ChromeToAgent {
    269  optional ContentAnalysisRequest request = 1;
    270  optional ContentAnalysisAcknowledgement ack = 2;
    271  optional ContentAnalysisCancelRequests cancel = 3;
    272 }
    273 
    274 // Generic message sent from Agent to Chrome.
    275 message AgentToChrome {
    276  optional ContentAnalysisResponse response = 1;
    277 }