Home | History | Annotate | Download | only in safe_browsing
      1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 //
      5 // Safe Browsing reporting protocol buffers.
      6 //
      7 // A ClientMalwareReportRequest is sent when a user opts-in to 
      8 // sending detailed malware reports from the safe browsing interstitial page.
      9 // 
     10 // It is a list of Resource messages, which may contain the url of a
     11 // resource such as the page in the address bar or any other resource
     12 // that was loaded for this page.
     13 //
     14 // In addition to the url, a resource can contain HTTP request and response
     15 // headers and bodies.
     16 
     17 syntax = "proto2";
     18 
     19 option optimize_for = LITE_RUNTIME;
     20 
     21 package safe_browsing;
     22 
     23 message ClientMalwareReportRequest {
     24 
     25   message HTTPHeader {
     26     required bytes name = 1;
     27     optional bytes value = 2;
     28   }
     29 
     30   message HTTPRequest {
     31     message FirstLine {
     32       optional bytes verb = 1;  // Also known as method, eg "GET"
     33       optional bytes uri = 2;
     34       optional bytes version = 3;
     35     }
     36     
     37     optional FirstLine firstline = 1;
     38     repeated HTTPHeader headers = 2;
     39     optional bytes body = 3;
     40 
     41     // bodydigest and bodylength can be useful if the report does not
     42     // contain the body itself.
     43     optional bytes bodydigest = 4;  
     44     optional int32 bodylength = 5;
     45   }
     46 
     47   message HTTPResponse {
     48     message FirstLine {
     49       optional int32 code = 1;
     50       optional bytes reason = 2;
     51       optional bytes version = 3;
     52     }
     53 
     54     optional FirstLine firstline = 1;
     55     repeated HTTPHeader headers = 2;
     56     optional bytes body = 3;
     57 
     58     // bodydigest and bodylength can be useful if the report does not
     59     // contain the body itself.
     60     optional bytes bodydigest = 4;
     61     optional int32 bodylength = 5;
     62     optional bytes remote_ip = 6;
     63   }
     64 
     65   message Resource {
     66     required int32 id = 1;
     67     optional string url = 2;
     68     optional HTTPRequest request = 3;
     69     optional HTTPResponse response = 4;
     70 
     71     optional int32 parent_id = 5;  // Id of the parent, if known.
     72 
     73     // A list of children. The order of the children in this list is
     74     // significant. The |parent_id| field for child nodes can be derived
     75     // from this, but this allows us to be more flexible.
     76     repeated int32 child_ids = 6;
     77 
     78     // Tag that was used to include this resource, eg "iframe"
     79     optional string tag_name = 7;
     80   }
     81 
     82   // URL of the resource that matches the safe browsing list.
     83   optional string malware_url = 1;
     84 
     85   // URL of the page in the address bar.
     86   optional string page_url = 2;
     87 
     88   optional string referrer_url = 3;
     89   repeated Resource resources = 4;
     90 
     91   // Whether the report has HTTP Responses.
     92   optional bool complete = 5;
     93 }
     94