1 // Copyright (c) 2012 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.
5 // Client side phishing and malware detection request and response
6 // protocol buffers. Those protocol messages should be kept in sync
7 // with the server implementation.
9 // If you want to change this protocol definition or you have questions
10 // regarding its format please contact chrome-anti-phishing@googlegroups.com.
14 option optimize_for = LITE_RUNTIME;
16 package safe_browsing;
18 message ClientPhishingRequest {
19 // URL that the client visited. The CGI parameters are stripped by the
21 optional string url = 1;
23 // A 5-byte SHA-256 hash prefix of the URL. Before hashing the URL is
24 // canonicalized, converted to a suffix-prefix expression and broadened
25 // (www prefix is removed and everything past the last '/' is stripped).
27 // Marked OBSOLETE because the URL is sent for all users, making the hash
28 // prefix unnecessary.
29 optional bytes OBSOLETE_hash_prefix = 10;
31 // Score that was computed on the client. Value is between 0.0 and 1.0.
32 // The larger the value the more likely the url is phishing.
33 required float client_score = 2;
35 // Note: we're skipping tag 3 because it was previously used.
37 // Is true if the features for this URL were classified as phishing.
38 // Currently, this will always be true for all client-phishing requests
39 // that are sent to the server.
40 optional bool is_phishing = 4;
43 // Feature name. E.g., 'PageHasForms'.
44 required string name = 1;
46 // Feature value is always in the range [0.0, 1.0]. Boolean features
48 required double value = 2;
51 // List of features that were extracted. Those are the features that were
52 // sent to the scorer and which resulted in client_score being computed.
53 repeated Feature feature_map = 5;
55 // The version number of the model that was used to compute the client-score.
56 // Copied from ClientSideModel.version().
57 optional int32 model_version = 6;
59 // Field 7 is only used on the server.
61 // List of features that are extracted in the client but are not used in the
62 // machine learning model.
63 repeated Feature non_model_feature_map = 8;
65 // The referrer URL. This field might not be set, for example, in the case
66 // where the referrer uses HTTPs.
67 // OBSOLETE: Use feature 'Referrer=<referrer>' instead.
68 optional string OBSOLETE_referrer_url = 9;
70 // Field 11 is only used on the server.
73 message ClientPhishingResponse {
74 required bool phishy = 1;
76 // A list of SafeBrowsing host-suffix / path-prefix expressions that
77 // are whitelisted. The client must match the current top-level URL
78 // against these whitelisted expressions and only apply a positive
79 // phishing verdict above if the URL does not match any expression
80 // on this whitelist. The client must not cache these whitelisted
81 // expressions. This whitelist will be empty for the vast majority
82 // of the responses but might contain up to 100 entries in emergency
85 // Marked OBSOLETE because the URL is sent for all users, so the server
86 // can do whitelist matching.
87 repeated string OBSOLETE_whitelist_expression = 2;
90 message ClientMalwareRequest {
91 // URL that the client visited. The CGI parameters are stripped by the
93 required string url = 1;
95 // Field 2 is deleted and no longer in use.
97 // Field 3 is only used on the server.
99 // The referrer URL. This field might not be set, for example, in the case
100 // where the referrer uses HTTPS.
101 optional string referrer_url = 4;
103 // Field 5 and 6 are only used on the server.
106 required string ip = 1;
107 required string url = 2;
108 optional string method = 3;
109 optional string referrer = 4;
110 // Resource type, the int value is a direct cast from the Type enum
111 // of ResourceType class defined in //src/webkit/commom/resource_type.h
112 optional int32 resource_type = 5;
115 // List of resource urls that match the malware IP list.
116 repeated UrlInfo bad_ip_url_info = 7;
119 message ClientMalwareResponse {
120 required bool blacklist = 1;
121 // The confirmed blacklisted bad IP and its url, which will be shown in
122 // malware warning, if the blacklist verdict is true.
123 // This IP string could be either in IPv4 or IPv6 format, which is the same
124 // as the ones client sent to server.
125 optional string bad_ip = 2;
126 optional string bad_url = 3;
129 message ClientDownloadRequest {
130 // The final URL of the download (after all redirects).
131 required string url = 1;
133 // This message contains various binary digests of the download payload.
135 optional bytes sha256 = 1;
136 optional bytes sha1 = 2;
137 optional bytes md5 = 3;
139 required Digests digests = 2;
141 // This is the length in bytes of the download payload.
142 required int64 length = 3;
144 // Type of the resources stored below.
146 // The final URL of the download payload. The resource URL should
147 // correspond to the URL field above.
149 // A redirect URL that was fetched before hitting the final DOWNLOAD_URL.
150 DOWNLOAD_REDIRECT = 1;
151 // The final top-level URL of the tab that triggered the download.
153 // A redirect URL thas was fetched before hitting the final TAB_URL.
158 required string url = 1;
159 required ResourceType type = 2;
160 optional bytes remote_ip = 3;
161 // This will only be set if the referrer is available and if the
162 // resource type is either TAB_URL or DOWNLOAD_URL.
163 optional string referrer = 4;
165 // TODO(noelutz): add the transition type?
168 // This repeated field will store all the redirects as well as the
169 // final URLs for the top-level tab URL (i.e., the URL that
170 // triggered the download) as well as for the download URL itself.
171 repeated Resource resources = 4;
173 // A trust chain of certificates. Each chain begins with the signing
174 // certificate of the binary, and ends with a self-signed certificate,
175 // typically from a trusted root CA. This structure is analogous to
176 // CERT_CHAIN_CONTEXT on Windows.
177 message CertificateChain {
178 // A single link in the chain.
180 // DER-encoded X.509 representation of the certificate.
181 optional bytes certificate = 1;
182 // Fields 2 - 7 are only used on the server.
184 repeated Element element = 1;
187 message SignatureInfo {
188 // All of the certificate chains for the binary's signing certificate.
189 // If no chains are present, the binary is not signed. Multiple chains
190 // may be present if any certificate has multiple signers.
191 repeated CertificateChain certificate_chain = 1;
193 // True if the signature was trusted on the client.
194 optional bool trusted = 2;
197 // This field will only be set if the binary is signed.
198 optional SignatureInfo signature = 5;
200 // True if the download was user initiated.
201 optional bool user_initiated = 6;
203 // Fields 7 and 8 are only used on the server.
205 // Name of the file where the download would be stored if the
206 // download completes. E.g., "bla.exe".
207 optional string file_basename = 9;
209 // Starting with Chrome M19 we're also sending back pings for Chrome
210 // extensions that get downloaded by users.
212 WIN_EXECUTABLE = 0; // Currently all .exe, .cab and .msi files.
213 CHROME_EXTENSION = 1; // .crx files.
214 ANDROID_APK = 2; // .apk files.
215 // .zip files containing one of the above executable types.
216 ZIPPED_EXECUTABLE = 3;
218 optional DownloadType download_type = 10 [default = WIN_EXECUTABLE];
220 // Locale of the device, eg en, en_US.
221 optional string locale = 11;
223 message PEImageHeaders {
225 optional bytes dos_header = 1;
226 // IMAGE_FILE_HEADER.
227 optional bytes file_header = 2;
228 // IMAGE_OPTIONAL_HEADER32. Present only for 32-bit PE images.
229 optional bytes optional_headers32 = 3;
230 // IMAGE_OPTIONAL_HEADER64. Present only for 64-bit PE images.
231 optional bytes optional_headers64 = 4;
232 // IMAGE_SECTION_HEADER.
233 repeated bytes section_header = 5;
234 // Contents of the .edata section.
235 optional bytes export_section_data = 6;
238 // IMAGE_DEBUG_DIRECTORY.
239 optional bytes directory_entry = 1;
240 optional bytes raw_data = 2;
243 repeated DebugData debug_data = 7;
246 message ImageHeaders {
247 // Windows Portable Executable image headers.
248 optional PEImageHeaders pe_headers = 1;
251 // Fields 12-17 are reserved for server-side use and are never sent by the
254 optional ImageHeaders image_headers = 18;
257 message ClientDownloadResponse {
259 // Download is considered safe.
261 // Download is considered dangerous. Chrome should show a warning to the
264 // Download is unknown. Chrome should display a less severe warning.
266 // The download is potentially unwanted.
267 POTENTIALLY_UNWANTED = 3;
268 // The download is from a dangerous host.
271 required Verdict verdict = 1;
274 // A human-readable string describing the nature of the warning.
275 // Only if verdict != SAFE. Localized based on request.locale.
276 optional string description = 1;
278 // A URL to get more information about this warning, if available.
279 optional string url = 2;
281 optional MoreInfo more_info = 2;
283 // An arbitrary token that should be sent along for further server requests.
284 optional bytes token = 3;
287 // The following protocol buffer holds the feedback report gathered
288 // from the user regarding the download.
289 message ClientDownloadReport {
290 // The information of user who provided the feedback.
291 // This is going to be useful for handling appeals.
292 message UserInformation {
293 optional string email = 1;
302 // The type of feedback for this report.
303 optional Reason reason = 1;
305 // The original download ping
306 optional ClientDownloadRequest download_request = 2;
308 // Stores the information of the user who provided the feedback.
309 optional UserInformation user_information = 3;
311 // Unstructed comments provided by the user.
312 optional bytes comment = 4;
314 // The original download response sent from the verdict server.
315 optional ClientDownloadResponse download_response = 5;
318 // This is used to send back upload status to the client after upload completion
319 message ClientUploadResponse {
321 // The upload was successful and a complete response can be expected
324 // The upload was unsuccessful and the response is incomplete.
328 // Holds the upload status
329 optional UploadStatus status = 1;
331 // Holds the permalink where the results of scanning the binary are available
332 optional string permalink = 2;