File: csd.proto

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (2739 lines) | stat: -rw-r--r-- 102,455 bytes parent folder | download | duplicates (2)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This proto file includes:
// (1) Client side phishing and malware detection request and response
//   protocol buffers.  Those protocol messages should be kept in sync
//   with the server implementation.
//
// (2) Safe Browsing reporting protocol buffers.
//   A ClientSafeBrowsingReportRequest is sent when a user opts-in to
//   sending detailed threat reports from the safe browsing interstitial page.
//   It is a list of Resource messages, which may contain the url of a
//   resource such as the page in the address bar or any other resource
//   that was loaded for this page.
//   In addition to the url, a resource can contain HTTP request and response
//   headers and bodies.
//
// If you want to change this protocol definition or you have questions
// regarding its format please contact safebrowsing@chromium.org.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package safe_browsing;

// Protocol buffer describing the Chrome user population of the user reporting
// data.
message ChromeUserPopulation {
  enum UserPopulation {
    UNKNOWN_USER_POPULATION = 0;
    SAFE_BROWSING = 1;  // Equivalent to standard protection.
    EXTENDED_REPORTING = 2;
    ENHANCED_PROTECTION = 3;
  }
  optional UserPopulation user_population = 1;

  // If user enabled history sync.
  optional bool is_history_sync_enabled = 2;

  // The finch active groups this user belongs to (if any). Active group is
  // defined by finch trial name and group name. Trial name and group name are
  // concatenated with separator ".", e.g. "PingOnlyTrial.DefaultGroup".
  repeated string finch_active_groups = 4;

  // Whether and how the current Chrome profile is being managed.
  enum ProfileManagementStatus {
    // Value not set.
    UNKNOWN = 0;

    // Profile management status is unavailable.
    UNAVAILABLE = 1;

    // The profile is not managed.
    NOT_MANAGED = 2;

    // Chrome is being managed by enterprise policies.
    ENTERPRISE_MANAGED = 3;
  }
  optional ProfileManagementStatus profile_management_status = 5
      [default = UNKNOWN];

  // Indicates if user opted in advanced protection program.
  optional bool is_under_advanced_protection = 6;

  // Indicates if user is in incognito mode.
  optional bool is_incognito = 7;

  // If the user is opted in to MBB.
  optional bool is_mbb_enabled = 8;

  // The simplified user agent string (e.g. Chrome/xy.0.abcd.e/Windows).
  optional string user_agent = 9;

  // The total number of profiles available on this machine. Some of these may
  // not be fully initialized so can't be used.
  optional int32 number_of_profiles = 10;

  // The number of created and fully initialized profiles. Some of these
  // profiles may be inactive.
  optional int32 number_of_loaded_profiles = 11;

  // Deprecated: number_of_open_profiles
  reserved 12;

  // Server-side only field.
  reserved 13;

  // Tokens to connect different requests on the same page, used for measuring
  // the performance of Safe Browsing protections. If two requests have the
  // same token, it means they are from the same user visiting the same page.
  // See go/chrome-sb-pageload-tokens.
  message PageLoadToken {
    // The source that generates the token.
    enum TokenSource {
      SOURCE_UNSPECIFIED = 0;
      // The token is randomly generated on the client-side. It is 32 bytes
      // long.
      CLIENT_GENERATION = 1;
    }
    optional TokenSource token_source = 1;
    // The timestamp when the token is generated or received.
    optional int64 token_time_msec = 2;
    // The value of the token.
    optional bytes token_value = 3;
  }
  // Note: This field is set as repeated to support tokens from multiple
  // sources.
  repeated PageLoadToken page_load_tokens = 14;

  // The current state of account-level enhanced safe browsing (A-ESB) as is
  // known by the client. This is an optional field and represents the state of
  // A-ESB as the client has observed it to be. This value will be set for sync
  // users as well as signed-in users. The state on the server may be
  // different from the value that the client has when setting this field.
  // See: go/esb-mms-integration-dd.
  optional bool is_aesb_enabled = 15;

  // The time when the account-level enhanced safe browsing (A-ESB) bit state
  // was last sent updated on the client. This is an optional field.
  optional int64 aesb_last_update_time_windows_epoch_micros = 16;

  // Server-side only field.
  reserved 17;

  // If user has signed in. The user may or may not have sync enabled. For sync
  // status, check is_history_sync_enabled instead.
  optional bool is_signed_in = 18;

  // Server-side only field.
  reserved 19;
}

// Identifies a web app (e.g. a WebAPK) on the basis of its origin and id, as
// defined in https://www.w3.org/TR/appmanifest/#id-member.
message SafeBrowsingWebAppKey {
  // Serialized origin without the scheme portion. In most cases, this is just
  // the host part. May include a colon character followed by a port number, if
  // the port number is non-default.
  optional string start_url_origin = 1;
  // Manifest id or (if there is no id) the path and query portions of
  // start_url, without leading slash character, e.g. will be empty string if
  // the path is "/". This should not include URL fragments, but should include
  // query params.
  optional string id_or_start_path = 2;
}

message ImageFeatureEmbedding {
  // Tracking embedding-model's version from iteration to iteration
  optional int32 embedding_model_version = 1;

  // Raw tensor output of the embedding layer.
  repeated float embedding_value = 2;
}

// The metadata for the Llama-CSD trigger rules which are propagated to
// CSD-Phishing server through Chrome.
message LlamaTriggerRuleInfo {
  // Unique id for the llama-csd forced trigger rule
  optional int32 llama_trigger_rule_id = 1;
  // Whether to request additional intelligence from Chrome.
  optional bool intelligent_scan = 2;
}

message LlamaForcedTriggerInfo {
  repeated LlamaTriggerRuleInfo llama_trigger_rule_infos = 1;
  // True if requested by any of the trigger rules.
  optional bool intelligent_scan = 2;
  // URL responsible to trigger the ping.
  optional string trigger_url = 3;
}

message IntelligentScanInfo {
  optional string brand = 1;
  optional string intent = 2;

  // Reason why the brand and intent are empty.
  enum NoInfoReason {
    NO_INFO_REASON_UNSPECIFIED = 0;
    // Client cannot infer the brand and intent because there is no text on the
    // page.
    EMPTY_TEXT = 1;
    // Allowlisted by high confidence allowlist.
    ALLOWLISTED = 2;
    // The on device model is unavailable, which can be from a few reasons such
    // as device incapability or not enough space on disk.
    ON_DEVICE_MODEL_UNAVAILABLE = 3;
  }
  optional NoInfoReason no_info_reason = 3;
}

message ClientPhishingRequest {
  // URL that the client visited.  The CGI parameters are stripped by the
  // client.
  optional string url = 1;

  // A 5-byte SHA-256 hash prefix of the URL.  Before hashing the URL is
  // canonicalized, converted to a suffix-prefix expression and broadened
  // (www prefix is removed and everything past the last '/' is stripped).
  //
  // Marked OBSOLETE because the URL is sent for all users, making the hash
  // prefix unnecessary.
  optional bytes OBSOLETE_hash_prefix = 10;

  // Score that was computed on the client.  Value is between 0.0 and 1.0.
  // The larger the value the more likely the url is phishing.
  required float client_score = 2;

  // Note: we're skipping tag 3 because it was previously used.

  // Is true if the features for this URL were classified as phishing.
  // Currently, this will always be true for all client-phishing requests
  // that are sent to the server.
  optional bool is_phishing = 4;

  message Feature {
    // Feature name.  E.g., 'PageHasForms'.
    required string name = 1;

    // Feature value is always in the range [0.0, 1.0].  Boolean features
    // have value 1.0.
    required double value = 2;
  }

  // List of features that were extracted.  Those are the features that were
  // sent to the scorer and which resulted in client_score being computed.
  repeated Feature feature_map = 5;

  // The version of the DOM model used for classification
  optional int32 dom_model_version = 27;

  // The version number of the model that was used to compute the client-score.
  // Copied from ClientSideModel.version().
  optional int32 model_version = 6;

  // Field 7 is only used on the server.
  reserved 7;

  // List of features that are extracted in the client but are not used in the
  // machine learning model.
  repeated Feature non_model_feature_map = 8;

  // The referrer URL.  This field might not be set, for example, in the case
  // where the referrer uses HTTPs.
  // OBSOLETE: Use feature 'Referrer=<referrer>' instead.
  optional string OBSOLETE_referrer_url = 9;

  // Field 11 is only used on the server.
  reserved 11;

  // List of shingle hashes we extracted.
  repeated uint32 shingle_hashes = 12 [packed = true];

  // The model filename (basename) that was used by the client. Deprecated.
  optional string DEPRECATED_model_filename = 13 [deprecated = true];

  // Population that the reporting user is part of.
  optional ChromeUserPopulation population = 14;

  // Server-side only fields.
  reserved 15;
  reserved 16;

  // Deprecated fields
  reserved 17;
  reserved 18;
  reserved 19;
  reserved 20;

  // Indicates whether the request is due to a match on the DOM features.
  optional bool is_dom_match = 21;

  // If we can find the complete referrer chain, this field will contains URLs
  // transitions from landing referrer to event in reverse chronological
  // order, i.e. event url comes first in this list, and landing referrer
  // comes last.
  // For Enhanced Protection users, if the referrer
  // chain is empty or partially missing, we will add/append recent navigation
  // events to this list. The type of these entries will be RECENT_NAVIGATION.
  repeated ReferrerChainEntry referrer_chain = 22;

  // The version of the TFLite model used for classification
  optional int32 tflite_model_version = 23;

  message CategoryScore {
    optional string label = 1;
    optional float value = 2;
  }
  // The resulting score from the TFLite model
  repeated CategoryScore tflite_model_scores = 24;

  // Whether the TFLite model believed the page was phishy.
  optional bool is_tflite_match = 25;

  // Visual features of the current page. Only filled in for extended reporting
  // users.
  optional VisualFeatures visual_features = 26;

  // This is used to identify what process sent the ping.
  optional ClientSideDetectionType client_side_detection_type = 28;

  // Image embedding from model output tensor
  optional ImageFeatureEmbedding image_feature_embedding = 29;

  enum ReportType {
    REPORT_TYPE_UNSPECIFIED = 0;
    // Normal/full ping to Safe Browsing containing all the fields in the
    // ClientPhishingRequest.
    FULL_REPORT = 1;
    // Sample ping to Safe Browsing. This will override the local model result
    // when deciding to send the ping.
    SAMPLE_REPORT = 2;
  }

  optional ReportType report_type = 30;

  // The information of Llama trigger rules that triggered a CSD ping. Set only
  // if client_side_detection_type = FORCE_REQUEST.
  optional LlamaForcedTriggerInfo llama_forced_trigger_info = 31;

  // Represents the on-device model LLM response.
  optional IntelligentScanInfo intelligent_scan_info = 32;

  // next available tag number: 33.
}

// Verdict based on IntelligentScanInfo included in ClientPhishingRequest
enum IntelligentScanVerdict {
  INTELLIGENT_SCAN_VERDICT_UNSPECIFIED = 0;
  INTELLIGENT_SCAN_VERDICT_SAFE = 1;
  SCAM_EXPERIMENT_VERDICT_1 = 2;
  SCAM_EXPERIMENT_VERDICT_2 = 3;
  SCAM_EXPERIMENT_CATCH_ALL_ENFORCEMENT = 999;
  SCAM_EXPERIMENT_CATCH_ALL_TELEMETRY = 1000;
}

message ClientPhishingResponse {
  required bool phishy = 1;

  // A list of SafeBrowsing host-suffix / path-prefix expressions that
  // are allowlisted.  The client must match the current top-level URL
  // against these alllowlisted expressions and only apply a positive
  // phishing verdict above if the URL does not match any expression
  // on this allowlist.  The client must not cache these allowlisted
  // expressions.  This allowlist will be empty for the vast majority
  // of the responses but might contain up to 100 entries in emergency
  // situations.
  //
  // Marked OBSOLETE because the URL is sent for all users, so the server
  // can do allowlist matching.
  repeated string OBSOLETE_allowlist_expression = 2;

  optional IntelligentScanVerdict intelligent_scan_verdict = 3;
}

// Enum used to keep stats about why the pre-classification check failed.
// These values are persisted to logs and used in client_side_detection_host.
// Entries should not be renumbered and numeric values should never be reused.
enum PreClassificationCheckResult {
  OBSOLETE_NO_CLASSIFY_PROXY_FETCH = 0;
  NO_CLASSIFY_PRIVATE_IP = 1;
  NO_CLASSIFY_OFF_THE_RECORD = 2;
  NO_CLASSIFY_MATCH_CSD_ALLOWLIST = 3;
  NO_CLASSIFY_TOO_MANY_REPORTS = 4;
  NO_CLASSIFY_UNSUPPORTED_MIME_TYPE = 5;
  NO_CLASSIFY_NO_DATABASE_MANAGER = 6;
  NO_CLASSIFY_KILLSWITCH = 7;
  NO_CLASSIFY_CANCEL = 8;
  NO_CLASSIFY_RESULT_FROM_CACHE = 9;
  DEPRECATED_NO_CLASSIFY_NOT_HTTP_URL = 10;
  NO_CLASSIFY_SCHEME_NOT_SUPPORTED = 11;
  NO_CLASSIFY_ALLOWLISTED_BY_POLICY = 12;
  CLASSIFY = 13;
  NO_CLASSIFY_HAS_DELAYED_WARNING = 14;
  NO_CLASSIFY_LOCAL_RESOURCE = 15;
  NO_CLASSIFY_CHROME_UI_PAGE = 16;
  OBSOLETE_NO_CLASSIFY_NOT_ALLOWED_BY_POLICY = 17;
  NO_CLASSIFY_MATCH_HC_ALLOWLIST = 18;
  NO_CLASSIFY_ALLOWLIST_METRIC = 19;
  NO_CLASSIFY_MAX = 20;  // Always add before this, and update this value.
}

// This value must be kept in sync with those in
// components/safe_browsing/content/common/safe_browsing.mojom. The enum
// represents possible outcomes of the renderer-side classification.
enum PhishingDetectorResult {
  CLASSIFICATION_SUCCESS = 0;
  CLASSIFIER_NOT_READY = 1;
  CLASSIFICATION_CANCELLED = 2;
  FORWARD_BACK_TRANSITION = 3;
  INVALID_SCORE = 4;
  INVALID_URL_FORMAT_REQUEST = 5;
  INVALID_DOCUMENT_LOADER = 6;
  URL_FEATURE_EXTRACTION_FAILED = 7;
  DOM_EXTRACTION_FAILED = 8;
  TERM_EXTRACTION_FAILED = 9;
  VISUAL_EXTRACTION_FAILED = 10;
}

// The referring app info that launches Chrome. Only used on Android.
// This information may be spoofed so do not rely solely on its correctness
// for anti-abuse purposes. For more details, see:
// go/phishguard-referring-app-android.
message ReferringAppInfo {
  // The source of the referring_app_name.
  enum ReferringAppSource {
    REFERRING_APP_SOURCE_UNSPECIFIED = 0;
    // The referring app is known to Chrome. If the referring app info is from
    // this source, the referring_app_name is a hardcoded string that is
    // predefined in Chrome.
    KNOWN_APP_ID = 1;
    // The referring app is unknown to Chrome. The referring app name is
    // obtained from
    // https://developer.android.com/reference/android/provider/Browser?hl=en#EXTRA_APPLICATION_ID.
    // If the referring app info is from this source, the referring_app_name
    // is volatile and can be changed by the referring app.
    UNKNOWN_APP_ID = 2;
    // The referring app info is obtained from
    // https://developer.android.com/reference/android/app/Activity#getReferrer().
    // If the referring app info is from this source, the referring_app_name
    // is volatile and can be changed by the referring app.
    ACTIVITY_REFERRER = 3;
  }

  optional ReferringAppSource referring_app_source = 1;

  optional string referring_app_name = 2;

  // If Chrome was launched by a WebAPK, this field identifies that WebAPK.
  // Note: This is not mutually exclusive with referring_app_{source,name}. If
  // an external app launches a WebAPK which then launches Chrome,
  // referring_app_{source,name} will refer to the original referring app while
  // this referring_webapk field will refer to the WebAPK.
  optional SafeBrowsingWebAppKey referring_webapk = 3;
}

// The message is used for client request to determine whether the provided URL
// is safe for the purposes of entering user credentials for logging in.
message LoginReputationClientRequest {
  // The top level frame URL of the webpage that hosts the login form.
  optional string page_url = 1;

  // Type for the request.
  // It could be low reputation request or password reuse request.
  enum TriggerType {
    TRIGGER_TYPE_UNSPECIFIED = 0;
    UNFAMILIAR_LOGIN_PAGE = 1;
    PASSWORD_REUSE_EVENT = 2;
  }
  optional TriggerType trigger_type = 2;

  // The message contains features which can describe a frame. A frame can be
  // a top level web page or an iframe.
  message Frame {
    // Id of a frame. The frame whose index = 0 is the top level web page.
    optional int32 frame_index = 1;

    // Id of the parent frame.
    optional int32 parent_frame_index = 2;

    // Url of the frame. If could be top level url (from web page) or url of
    // the iframe.
    optional string url = 3;

    // Whether the frame contains password field.
    optional bool has_password_field = 4;

    // If we can find the complete referrer chain, this field will contains URLs
    // transitions from landing referrer to event in reverse chronological
    // order, i.e. event url comes first in this list, and landing referrer
    // comes last.
    // For Safe Browsing Extended Reporting, if the referrer
    // chain is empty or partially missing, we will add/append recent navigation
    // events to this list. The type of these entries will be RECENT_NAVIGATION.
    repeated ReferrerChainEntry referrer_chain = 5;

    // Options and metadata about the above referrer chain.
    optional ReferrerChainOptions referrer_chain_options = 7;

    // The message contains features of a form.
    message Form {
      // Action url of the form.
      optional string action_url = 1;

      // Whether the form contains password field.
      optional bool has_password_field = 2;
    }

    repeated Form forms = 6;

    // next available tag number: 8.
  }

  repeated Frame frames = 3;

  // The message contains fields needed for a password reuse event.
  // Next tag: 7
  message PasswordReuseEvent {
    // Domains from the Chrome password manager DB that are associated with
    // the same password as the one triggering this event. The field is filled
    // in only when TriggerType is PASSWORD_REUSE_EVENT, and only for users
    // opted in to extended reporting.
    repeated string domains_matching_password = 1;

    // The frame that the password reuse is detected.
    optional int32 frame_id = 2;

    // Deprecated fields.
    reserved 3, 4;

    // TODO(crbug.com/41431428): Remove once ReusedPasswordAccountType is
    // implemented. Type of password being reused.
    enum ReusedPasswordType {
      REUSED_PASSWORD_TYPE_UNKNOWN = 0;

      // Password saved in Chrome's password manager.
      SAVED_PASSWORD = 1;

      // Password used in Chrome sign-in.
      SIGN_IN_PASSWORD = 2;

      // Other Gaia password used in Chrome's content area other than Chrome's
      // sign-in password.
      OTHER_GAIA_PASSWORD = 3;

      // Non-Gaia enterprise password captured from enterprise login page.
      ENTERPRISE_PASSWORD = 4;
    }
    optional ReusedPasswordType reused_password_type = 5
        [default = REUSED_PASSWORD_TYPE_UNKNOWN];

    message ReusedPasswordAccountType {
      // Whether the current reused password account is syncing.
      optional bool is_account_syncing = 1;

      enum AccountType {
        // User reused a password that is not a signed-in account, saved
        // password, or a non-GAIA enterprise account.
        UNKNOWN = 0;

        // User signed in with a dasher account.
        GSUITE = 1;

        // User signed in with @gmail.com, or @googlemail.com account.
        GMAIL = 2;

        // Password used for Enterprise login on an Enterprise login page.
        NON_GAIA_ENTERPRISE = 3;

        // Password saved in Chrome's password manager.
        SAVED_PASSWORD = 4;
      }
      optional AccountType account_type = 2;
    }

    optional ReusedPasswordAccountType reused_password_account_type = 6;
  }

  optional PasswordReuseEvent password_reuse_event = 4;

  // The number of verdicts stored on the client.
  optional int32 stored_verdict_cnt = 5;

  // Chrome user population.
  optional ChromeUserPopulation population = 6;

  // If user clicked through safe browsing interstitial on this page.
  optional bool clicked_through_interstitial = 7;

  // The MIME type of the page, e.g. "application/pdf".
  optional string content_type = 8;

  // Content area height in DIPs. This field should only be filled for extended
  // reporting users.
  optional int32 content_area_height = 9;

  // Content area width in DIPs. This field should only be filled for extended
  // reporting users.
  optional int32 content_area_width = 10;

  // Visual features of the current page. This field should only be filled for
  // extended reporting users.
  optional VisualFeatures visual_features = 11;

  // DOM features of the current page.
  optional DomFeatures dom_features = 12;

  enum ReportType {
    UNKNOWN = 0;
    // Normal/full ping to Safe Browsing containing all the fields in the
    // PasswordProtectionRequest.
    FULL_REPORT = 1;
    // Sample ping to Safe Browsing containing only the stripped URL and
    // referrer chain.
    SAMPLE_REPORT = 2;
  }
  // Whether the ping sent to Safe Browsing is a normal (full request) ping or a
  // sample ping for URLs on the allow-list.
  optional ReportType report_type = 13;

  // Information about Simplified URL display experiments in Chrome.
  // See go/phishguard-ping-spoof-detection
  message UrlDisplayExperiment {
    // True if SafeBrowsingDelayedWarnings is enabled.
    optional bool delayed_warnings_enabled = 1;
    // True if the "mouse" parameter of SafeBrowsingDelayedWarnings is enabled.
    optional bool delayed_warnings_mouse_clicks_enabled = 2;

    // True if RevealSteadyStateUrlPathQueryAndRefOnHover is enabled.
    optional bool reveal_on_hover = 3;
    // True if HideSteadyStateUrlPathQueryAndRefOnInteraction is enabled.
    optional bool hide_on_interaction = 4;
    // True if OmniboxUIExperimentElideToRegistrableDomain is enabled.
    optional bool elide_to_registrable_domain = 5;

    // Deprecated: simplified_url_display_enabled.
    reserved 6;
  };
  optional UrlDisplayExperiment url_display_experiment = 14;

  optional ReferringAppInfo referring_app_info = 15;

  // The debugging metadata holds information regarding the results within the
  // CSD-Phishing process. This debugging metadata helps understand what the
  // results were from CSD-Phishing for the same URL page, especially in cases
  // where CSD-Phishing ping was not sent.
  message DebuggingMetadata {
    // Trigger model version that was used to classify for CSD-Phishing.
    optional int32 csd_model_version = 1;

    // Result to show whether preclassification check has failed or not.
    optional PreClassificationCheckResult preclassification_check_result = 2;

    // Result representing possible outcomes of renderer-side classification.
    optional PhishingDetectorResult phishing_detector_result = 3;

    // Represents the local verdict result through thresholds classification.
    optional bool local_model_detects_phishing = 4;

    // Represents whether a CSD-Phishing ping was sent forcefully based on
    // ProLlama verdicts.
    optional bool forced_request = 5;

    // Integer value interpretation can be found at: /net/base/net_error_list.h.
    optional int32 network_result = 6;
  }

  optional DebuggingMetadata csd_debugging_metadata = 16;
}

// The message is used for client response for login reputation requests.
message LoginReputationClientResponse {
  // Type of verdicts issued by the server.
  enum VerdictType {
    VERDICT_TYPE_UNSPECIFIED = 0;
    // No warning will be displayed.
    SAFE = 1;
    // The site has low reputation or low popularity.
    LOW_REPUTATION = 2;
    // The url matches with blocklist entries.
    PHISHING = 3;
  }
  optional VerdictType verdict_type = 1;

  // TTL of the verdict in seconds.
  optional int64 cache_duration_sec = 2;

  // A host-suffix/path-prefix expression which defines a collections of pages
  // with common ownership from the same domain.
  // Generally, the pattern is defined on the granularity of domains.
  // For domains managed by multiple parties, especially in the case of large
  // hosting sites (e.g., geocities.com), we further divide the domains.
  //
  // Examples:
  //    www.google.com/foo/bar?param=val -> google.com
  //    www.geocities.com/foo/bar.html -> geocities.com/foo
  //    adwords.blogspot.com/index.html -> adwords.blogspot.com
  //
  // The pattern will always match the page_url of the request, and will be
  // a substring of page_url.
  optional string cache_expression = 3;

  // Deprecated.
  optional bool DEPRECATED_cache_expression_exact_match = 4 [deprecated = true];

  // A token unique to each request which correlates response and post-warning
  // actions.
  optional bytes verdict_token = 5;
}

// This message encapsulates all the visual features of the current page.
message VisualFeatures {
  reserved 1;

  // Represents the blurred, downsampled image of the login page.
  message BlurredImage {
    // The width of the image.
    optional int32 width = 1;

    // The height of the image.
    optional int32 height = 2;

    // The image data, stored in RGB order. This will have length
    // 3*width*height. The bytes are stored in row-major order, starting from
    // the top most row.
    optional bytes data = 3;
  }

  // Blurred, downsampled image of the current page.
  // Using Rec 2020 color space:
  // https://en.wikipedia.org/wiki/Rec._2020
  optional BlurredImage image = 2;
}

// This message encapsulates all the DOM features of the current page.
message DomFeatures {
  message Feature {
    // Feature name. E.g., 'PageHasForms'
    optional string name = 1;

    // Feature value is always in the range [0.0, 1.0].  Boolean features
    // have value 1.0.
    optional double value = 2;
  }

  // List of features extracted.
  repeated Feature feature_map = 1;

  // List of shingle hashes we extracted.
  repeated uint32 shingle_hashes = 2 [packed = true];

  // The model version used to generate these hashes. This is copied from
  // ClientSideModel.version(). The model sets the term list, which affects
  // the feature extraction.
  optional int32 model_version = 3;
}

message ClientDownloadRequest {
  // The final URL of the download (after all redirects).
  required string url = 1;

  // This message contains various binary digests of the download payload.
  message Digests {
    optional bytes sha256 = 1;
    optional bytes sha1 = 2;
    optional bytes md5 = 3;
  }
  required Digests digests = 2;

  // This is the length in bytes of the download payload.
  required int64 length = 3;

  // Type of the resources stored below.
  enum ResourceType {
    // The final URL of the download payload.  The resource URL should
    // correspond to the URL field above.
    DOWNLOAD_URL = 0;
    // A redirect URL that was fetched before hitting the final DOWNLOAD_URL.
    DOWNLOAD_REDIRECT = 1;
    // The final top-level URL of the tab that triggered the download.
    TAB_URL = 2;
    // A redirect URL thas was fetched before hitting the final TAB_URL.
    TAB_REDIRECT = 3;
    // The document URL for a PPAPI plugin instance that initiated the download.
    // This is the document.url for the container element for the plugin
    // instance.
    PPAPI_DOCUMENT = 4;
    // The plugin URL for a PPAPI plugin instance that initiated the download.
    PPAPI_PLUGIN = 5;
  }

  message Resource {
    required string url = 1;
    required ResourceType type = 2;
    optional bytes remote_ip = 3;
    // This will only be set if the referrer is available and if the
    // resource type is either TAB_URL or DOWNLOAD_URL.
    optional string referrer = 4;

    // TODO(noelutz): add the transition type?
  }

  // This repeated field will store all the redirects as well as the
  // final URLs for the top-level tab URL (i.e., the URL that
  // triggered the download) as well as for the download URL itself.
  repeated Resource resources = 4;

  // A trust chain of certificates.  Each chain begins with the signing
  // certificate of the binary, and ends with a self-signed certificate,
  // typically from a trusted root CA.  This structure is analogous to
  // CERT_CHAIN_CONTEXT on Windows.
  message CertificateChain {
    // A single link in the chain.
    message Element {
      // DER-encoded X.509 representation of the certificate.
      optional bytes certificate = 1;
      // Fields 2 - 7 are only used on the server.
      reserved 2 to 7;
    }
    repeated Element element = 1;
  }

  // This is an OS X only message to report extended attribute informations.
  // Extended attributes on OS X are used for various security mechanisms,
  // which makes them interesting to Chrome.
  message ExtendedAttr {
    // This is the name of the extended attribute.
    required string key = 1;
    // This is the value of the extended attribute.
    optional bytes value = 2;
  }

  message SignatureInfo {
    // All certificate chains for each of the binary's signers.  Multiple chains
    // may be present if the binary or any certificate has multiple signers.
    // Absence of certificate chains does not imply that the binary is not
    // signed (in that case, SignedData blobs extracted from the binary may be
    // preset), but does mean that trust has not been verified.
    repeated CertificateChain certificate_chain = 1;

    // True if the signature was trusted on the client.
    optional bool trusted = 2;

    // On Windows, PKCS#7 SignedData blobs extracted from a portable executable
    // image's attribute certificate table. The presence of these does not imply
    // that the signatures were deemed trusted by the client.
    // On Mac, this is the code signature blob referenced by the
    // LC_CODE_SIGNATURE load command.
    repeated bytes signed_data = 3;

    // On OS X, code signing data can be contained in the extended attributes of
    // a file. As Gatekeeper respects this signature, we look for it and collect
    // it.
    repeated ExtendedAttr xattr = 4;
  }

  // This field will only be set if the binary is signed.
  optional SignatureInfo signature = 5;

  // True if the download was user initiated.
  optional bool user_initiated = 6;

  // Fields 7 and 8 are only used on the server.
  reserved 7, 8;

  // Name of the file where the download would be stored if the
  // download completes.  E.g., "bla.exe".
  optional string file_basename = 9;

  // Starting with Chrome M19 we're also sending back pings for Chrome
  // extensions that get downloaded by users.
  enum DownloadType {
    WIN_EXECUTABLE = 0;    // Currently all .exe, .cab and .msi files.
    CHROME_EXTENSION = 1;  // .crx files.
    ANDROID_APK = 2;       // .apk files.
    // .zip files containing one of the other executable types.
    ZIPPED_EXECUTABLE = 3;
    MAC_EXECUTABLE = 4;  // .dmg, .pkg, etc.
    ZIPPED_ARCHIVE = 5;  // .zip file containing another archive.
    ARCHIVE = 6;         // Archive that doesn't have a specific DownloadType.
    // A .zip that Chrome failed to unpack to the point of finding exe/zips.
    INVALID_ZIP = 7;
    // A .dmg, .pkg, etc, that Chrome failed to unpack to the point of finding
    // Mach O's.
    MAC_ARCHIVE_FAILED_PARSING = 8;
    // A download request initiated via PPAPI. Typically the requestor is
    // a Flash applet.
    PPAPI_SAVE_REQUEST = 9;
    // A file we don't support, but we've decided to sample and send
    // a light-ping.
    SAMPLED_UNSUPPORTED_FILE = 10;
    // .rar file containing one of the other executable types.
    RAR_COMPRESSED_EXECUTABLE = 11;
    // .rar file containing another archive.
    RAR_COMPRESSED_ARCHIVE = 12;
    // .rar file that Chrome failed to unpack to the point of finding
    // executables or archives.
    INVALID_RAR = 13;
    // Office Document or PDF.
    DOCUMENT = 14;

    // .7z archive
    SEVEN_ZIP_COMPRESSED_EXECUTABLE = 15;
    SEVEN_ZIP_COMPRESSED_ARCHIVE = 16;
    INVALID_SEVEN_ZIP = 17;
  }
  optional DownloadType download_type = 10 [default = WIN_EXECUTABLE];

  // Locale of the device, eg en, en_US.
  optional string locale = 11;

  message PEImageHeaders {
    // IMAGE_DOS_HEADER.
    optional bytes dos_header = 1;
    // IMAGE_FILE_HEADER.
    optional bytes file_header = 2;
    // IMAGE_OPTIONAL_HEADER32. Present only for 32-bit PE images.
    optional bytes optional_headers32 = 3;
    // IMAGE_OPTIONAL_HEADER64. Present only for 64-bit PE images.
    optional bytes optional_headers64 = 4;
    // IMAGE_SECTION_HEADER.
    repeated bytes section_header = 5;
    // Contents of the .edata section.
    optional bytes export_section_data = 6;

    message DebugData {
      // IMAGE_DEBUG_DIRECTORY.
      optional bytes directory_entry = 1;
      optional bytes raw_data = 2;
    }

    repeated DebugData debug_data = 7;
  }

  message MachOHeaders {
    // The mach_header or mach_header_64 struct.
    required bytes mach_header = 1;

    message LoadCommand {
      // |command_id| is the first uint32 of |command| as well, but is
      // extracted for easier processing.
      required uint32 command_id = 1;
      // The entire data stream of the load command.
      required bytes command = 2;
    }

    // All the load commands of the Mach-O file.
    repeated LoadCommand load_commands = 2;
  }

  message ImageHeaders {
    // Windows Portable Executable image headers.
    optional PEImageHeaders pe_headers = 1;

    // OS X Mach-O image headers.
    repeated MachOHeaders mach_o_headers = 2;
  };

  // Fields 12-17 are reserved for server-side use and are never sent by the
  // client.
  reserved 12 to 17;

  optional ImageHeaders image_headers = 18;

  // Fields 19-21 are reserved for server-side use and are never sent by the
  // client.
  reserved 19 to 21;

  // A binary or archive contained in an archive (e.g., a .exe in a .zip
  // archive, or a .zip inside a .zip).
  message ArchivedBinary {
    // The path of the entry within the archive. For example, if a .zip contains
    // a directory foo with a file bar.exe inside, this will be "foo/bar.exe"
    optional string file_path = 1;
    optional DownloadType download_type = 2;
    optional Digests digests = 3;
    optional int64 length = 4;
    optional SignatureInfo signature = 5;
    optional ImageHeaders image_headers = 6;

    // Indicates if the given file is password protected.
    optional bool is_encrypted = 7;

    // Only used on the client side, since filtering for executable files
    // happens after the utility process has finished analyzing the archive.
    optional bool is_executable = 8;
    optional bool is_archive = 9;
  }

  repeated ArchivedBinary archived_binary = 22;

  // The Safety Net shared ID. Populated only for Android download protection.
  // TODO(crbug.com/397407934): Add this field for real.
  // optional string safety_net_id = 23;

  // Population that the reporting user is part of.
  optional ChromeUserPopulation population = 24;

  // This field has been deprecated and replaced with
  // `archive_summary.parser_status`.
  optional bool DEPRECATED_archive_valid = 26 [deprecated = true];

  // True if this ClientDownloadRequest is from a allowlisted domain.
  optional bool skipped_url_allowlist = 28;

  // True if this ClientDownloadRequest contains a allowlist certificate.
  optional bool skipped_certificate_allowlist = 31;

  // PPAPI_SAVE_REQUEST type messages may have more than one suggested filetype.
  // Each element in this collection indicates an alternate extension including
  // the leading extension separator.
  repeated string alternate_extensions = 35;

  // If we can find the complete referrer chain, this field will contains URLs
  // transitions from landing referrer to event in reverse chronological
  // order, i.e. event url comes first in this list, and landing referrer
  // comes last.
  // For Safe Browsing Extended Reporting, if the referrer chain
  // is empty or partially missing, we will add/append recent navigation events
  // to this list. The type of these entries will be RECENT_NAVIGATION.
  repeated ReferrerChainEntry referrer_chain = 36;

  // Options and metadata about the above referrer chain.
  optional ReferrerChainOptions referrer_chain_options = 50;

  // Deprecated.
  optional bool DEPRECATED_download_attribution_finch_enabled = 39
      [deprecated = true];

  // The Mac disk image code signature.
  // The underlying structure of code signature is defined at
  // https://opensource.apple.com/source/xnu/xnu-2782.1.97/bsd/sys/codesign.h
  optional bytes udif_code_signature = 40;

  // Mac-only. A detached code signature contains the DER-encoded PKCS7 data
  // of a codesigned artifact. Detached signatures are used for signing files
  // that are not Mach-O and thus cannot have a LC_CODE_SIGNATURE load command.
  message DetachedCodeSignature {
    required string file_name = 1;
    required bytes contents = 2;
  }
  repeated DetachedCodeSignature detached_code_signature = 59;

  // When this is set to true, we expect the server to provide heightened
  // protection for Advanced Protection users.
  optional bool request_ap_verdicts = 67;

  // These fields have been deprecated and replaced with
  // `archive_summary.file_count` or `archive_summary.directory_count`.
  optional int32 DEPRECATED_archive_file_count = 68 [deprecated = true];
  optional int32 DEPRECATED_archive_directory_count = 69 [deprecated = true];

  // This data must not be sent to the server in ClientDownloadRequest.
  // This field was only used for display on chrome://safe-browsing. The token
  // value may be sent in the "Authorization: Bearer" HTTP request header.
  reserved 78;
  reserved "access_token";

  reserved 84;

  message ArchiveSummary {
    enum Status {
      UNKNOWN = 0;
      // The archive was successfully unpacked in its entirety.
      VALID = 1;
      // Parsing took too long.
      PARSER_TIMED_OUT = 2;
      // The archive was too large to parse.
      TOO_LARGE = 3;
      // Error writing to disk (e.g. disk full).
      DISK_ERROR = 4;
    }
    optional Status parser_status = 1;

    // The number of files and directories contained within.
    optional int32 file_count = 2;
    optional int32 directory_count = 3;

    // True if at least one entry is encrypted or headers are encrypted.
    optional bool is_encrypted = 4;
  }
  optional ArchiveSummary archive_summary = 85;

  // Additional information for the Safe Browsing server to generate tailored
  // verdicts. See go/tailored-download-proto.
  message TailoredInfo {
    // |version| helps the Safe Browsing server understand which tailored
    // warnings Chrome understands and generate responses accordingly. It should
    // be incremented by 1 when adding new fields in TailoredVerdict or making
    // changes to how these fields may be interpreted in Chrome.
    // Version 0: Client doesn't support tailored warnings. Any info set in
    // TailoredVerdict is ignored.
    // Version 1: Client supports CT warnings and suspicious archives. Supported
    // in M107. See go/tailored-download-v1.
    // Note: Version 1 can have inconsistent behavior because it uses
    // indeterminate UI strings (can be changed by a client-side feature flag).
    // Version 2: Client-side UI string/icon updates. Supported in M117.
    // Version 3: Client-side UI string update for suspicious archive warnings.
    // Supported in M120.
    // Version 4: Client supports tailored warnings on downloads page. Client
    // sends download reports without explicit user decision. Supported in M125.
    // Version 5: Fixed the issue that cookie theft warnings are not bypassable.
    // See https://crbug.com/350780005.
    optional int32 version = 1;
  }
  optional TailoredInfo tailored_info = 86;

  // Fields 87-90 are reserved for server-side use and are never sent by the
  // client.
  reserved 87 to 90;

  // The token from previous requests related to this download, if any exists.
  optional bytes previous_token = 91;

  // Fields 92-96 are reserved for server-side use and are never sent by the
  // client.
  reserved 92 to 96;

  // Records the app that launched Chrome. Populated on Android only.
  // This information may be spoofed so do not rely solely on its correctness
  // for anti-abuse purposes.
  optional ReferringAppInfo referring_app_info = 97;

  // Encapsulates available visual data associated with a download. This
  // corresponds to a screenshot of a single page associated with the download.
  message DownloadVisualFeatures {
    // Required. The URL associated with this screenshot, i.e. the main frame
    // URL of the displayed page content in the screenshot.
    optional string main_frame_url = 1;

    // Optional. This field is empty in the initial ClientDownloadRequest that
    // merely advertises the available visual features. This is populated with
    // screenshot data in the follow-up ClientDownloadRequest, when responding
    // to the server's `visual_features_requested`. The `image` field of
    // `visual_features` will contain image data for the blurred image.
    optional VisualFeatures visual_features = 2;

    // Describes the role of the page from which the screenshot is taken.
    enum PageType {
      PAGE_TYPE_UNSPECIFIED = 0;
      // The page from which the download originated, i.e. the page loaded in
      // the tab responsible for the download at the time of download
      // initiation.
      DOWNLOAD_ORIGINATED_PAGE = 1;
      // The page loaded in the active tab at the time of download initiation.
      // Note: This denotes a weaker association with the download than
      // DOWNLOAD_ORIGINATED_PAGE.
      ACTIVE_PAGE = 2;
    }

    // One of the following is required. Identifies the page on which the
    // screenshot was captured.
    oneof page {
      // If there is a ReferrerChainEntry associated with the page of this
      // screenshot, this field is its index in the `referrer_chain` field of
      // the enclosing ClientDownloadRequest.
      int32 referrer_chain_index = 3;
      // This enum value is used if there is no ReferrerChainEntry associated
      // with the page.
      PageType related_page = 4;
    }
  }

  // This field is used to both advertise the available visual features to the
  // server, and in the follow-up request to actually provide the requested
  // visual features. When visual features are provided here, this
  // ClientDownloadRequest will populate `previous_token` with the token value
  // from the ClientDownloadResponse that requested the visual features.
  // This is only populated for Enhanced Protection users.
  repeated DownloadVisualFeatures download_visual_features = 98;
}

message ReferrerChainOptions {
  // The number of recent navigations we'd like to collect. This number is
  // controlled by Finch parameter and its default value is 0.
  optional int32 recent_navigations_to_collect = 1 [default = 0];
}

// Please update SafeBrowsingNavigationObserverManager::SanitizeReferrerChain()
// if you're adding more fields to this message.
message ReferrerChainEntry {
  enum URLType {
    // URL of safe browsing events that are at the end of the referrer chain.
    // e.g. URL of a download, URL of a low reputation login page, etc.
    EVENT_URL = 1;  // e.g.

    // Landing page is the page user directly interacts with to trigger the
    // above event, e.g. the page where user clicks a download button.
    LANDING_PAGE = 2;

    // Landing referrer is the one user directly interacts with right before
    // navigating to the landing page.
    LANDING_REFERRER = 3;

    // Client redirect refers to committed navigation between landing page and
    // the targeted event, or between landing referrer page and landing page.
    // Client redirect is not triggered by user gesture.
    CLIENT_REDIRECT = 4;

    DEPRECATED_SERVER_REDIRECT = 5;  // Deprecated

    // For Safe Browsing Extended Reporting, if the referrer
    // chain is empty or partially missing, we will add/append recent navigation
    // events to this list. RECENT_NAVIGATION type is set for these cases.
    RECENT_NAVIGATION = 6;

    // The REFERRER type is used for entries that recede the LANDING_REFERRER in
    // the referrer chain, when more than two gestures are included in the
    // referrer chain.
    REFERRER = 7;
  }

  enum NavigationInitiation {
    // Convenient default value, should not be used in real ReferrerChainEntry.
    UNDEFINED = 0;

    // Navigation is initiated by the browser process. e.g. user enters url into
    // address bar, or user opens a bookmark. This isn't perfect reliable due to
    // some edge cases, such as forward/back navigation and opening a link from
    // context menu.
    BROWSER_INITIATED = 1;

    // Navigation is initiated by the renderer process and there is no user
    // gesture associate with this navigation. e.g.
    // * redirect via the <meta http-equiv="refresh"> tag
    // * change window.location.href
    RENDERER_INITIATED_WITHOUT_USER_GESTURE = 2;

    // Navigation is initiated by the renderer process and there is a clear user
    // gesture associate with this navigation. e.g.
    //  * <a> link click
    //  * using window.history.pushState (i.e. back, forward button interaction)
    RENDERER_INITIATED_WITH_USER_GESTURE = 3;

    // Navigation is initiated by the browser process and it is believed the
    // navigation is the result of the user copy and paste the address from the
    // browser into the address bar.
    COPY_PASTE_USER_INITIATED = 4;

    // Navigation is initiated by a click on a Push Notification.
    NOTIFICATION_INITIATED = 5;
  }

  message ServerRedirect {
    // [required] server redirect url
    optional string url = 1;

    // Additional fields for future expansion.
  }

  // [required] The url of this Entry.
  optional string url = 1;

  // Only set if it is different from |url|.
  optional string main_frame_url = 9;

  // Type of URLs, such as event url, landing page, etc.
  optional URLType type = 2 [default = CLIENT_REDIRECT];

  // IP addresses corresponding to this host.
  repeated string ip_addresses = 3;

  // Referrer url of this entry.
  optional string referrer_url = 4;

  // Main frame URL of referrer.
  // Only set if it is different from |referrer_url|.
  optional string referrer_main_frame_url = 5;

  // If this URL loads in a different tab/frame from previous one.
  optional bool is_retargeting = 6;

  optional double navigation_time_msec = 7;

  // Set only if server redirects happened in navigation.
  // The first entry in |server_redirect_chain| should be the original request
  // url, and the last entry should be the same as |url|.
  repeated ServerRedirect server_redirect_chain = 8;

  // How this navigation is initiated.
  optional NavigationInitiation navigation_initiation = 10;

  // Whether we think this entry may have been launched by an external
  // application. This will have no false negatives, but some false positives
  // are possible.
  optional bool maybe_launched_by_external_application = 11;

  // Whether subframe URLs are removed due to user consent restriction.
  // When this field is set to true, |url| is set to
  // their relative mainframe URLs and |main_frame_url| is cleared.
  optional bool is_subframe_url_removed = 12;

  // Whether subframe referrer URLs are removed due to user consent restriction.
  // When this field is set to true, |referrer_url| is set to
  // their relative mainframe URLs and |referrer_main_frame_url| is cleared.
  optional bool is_subframe_referrer_url_removed = 13;

  // Whether any of the URLs in the |url|, |main_frame_url|, |referrer_url|,
  // |referrer_main_frame_url| fields are removed because the URL matches the
  // SafeBrowsingAllowlistDomains enterprise policy in Chrome, or the URL is
  // recorded before the user consent.
  optional bool is_url_removed_by_policy = 14;

  // next available tag number: 15.
}  // End of ReferrerChainEntry

enum ClientSideDetectionType {
  CLIENT_SIDE_DETECTION_TYPE_UNSPECIFIED = 0;
  // Send a CSD request regardless of the client side model's score values.
  FORCE_REQUEST = 1;
  // Either the local DOM or visual model triggered.
  TRIGGER_MODELS = 2;
  // A Notification prompt triggered.
  NOTIFICATION_PERMISSION_PROMPT = 3;
  // Keyboard lock request triggered.
  KEYBOARD_LOCK_REQUESTED = 4;
  // Pointer lock request triggered.
  POINTER_LOCK_REQUESTED = 5;
  // Vibration API request triggered.
  VIBRATION_API = 6;
  // Fullscreen API request triggered.
  FULLSCREEN_API = 7;
}

message ClientDownloadResponse {
  enum Verdict {
    // Download is considered safe.
    SAFE = 0;
    // Download is considered dangerous.  Chrome should show a warning to the
    // user.
    DANGEROUS = 1;
    // Download is uncommon.  Chrome should display a less severe warning.
    UNCOMMON = 2;
    // The download is potentially unwanted.
    POTENTIALLY_UNWANTED = 3;
    // The download is from a dangerous host.
    DANGEROUS_HOST = 4;
    // The backend doesn't have confidence in its verdict of this file.
    // Chrome should show the default warning if configured for this file type.
    UNKNOWN = 5;
    // Download is associated with stealing cookies and account compromise.
    // Chrome should show a severe warning.
    DANGEROUS_ACCOUNT_COMPROMISE = 8;
  }
  optional Verdict verdict = 1 [default = SAFE];

  message MoreInfo {
    // A human-readable string describing the nature of the warning.
    // Only if verdict != SAFE. Localized based on request.locale.
    optional string description = 1;

    // A URL to get more information about this warning, if available.
    optional string url = 2;
  }
  optional MoreInfo more_info = 2;

  // An arbitrary token that should be sent along for further server requests.
  optional bytes token = 3;

  // Whether the server requests that this binary be uploaded.
  optional bool upload = 5;

  // Whether or not Chrome should prompt the user for deep scanning
  optional bool request_deep_scan = 19;

  // Verdict used as supplemental information to decide the tailored warning UI.
  // The |verdict| field takes precedence over this field (e.g. this field is
  // ignored if |verdict| is SAFE).
  message TailoredVerdict {
    enum TailoredVerdictType {
      VERDICT_TYPE_UNSPECIFIED = 0;
      // Download is associated with stealing cookies and account compromise.
      // Effective if |verdict| is DANGEROUS_ACCOUNT_COMPROMISE. Ignored
      // otherwise.
      COOKIE_THEFT = 1;
      // This archive's metadata indicates tactics used by attackers to
      // distribute malware and viruses. For example, it is encrypted to prevent
      // scanning by Safe Browsing. Effective if |verdict| is UNCOMMON. Ignored
      // otherwise.
      SUSPICIOUS_ARCHIVE = 2;
    }
    optional TailoredVerdictType tailored_verdict_type = 1;

    // This field provides flexibility on testing minor UI adjustments on
    // warnings. These adjustments are only expected to be set during UX
    // experiments. Only effective when |tailored_verdict_type| is set.
    enum ExperimentalWarningAdjustment {
      ADJUSTMENT_UNSPECIFIED = 0;
      // Include account information in the warning. Only apply to COOKIE_THEFT
      // tailored verdict.
      ACCOUNT_INFO_STRING = 1;
    }
    repeated ExperimentalWarningAdjustment adjustments = 2 [packed = true];
  }
  optional TailoredVerdict tailored_verdict = 20;

  // Whether this archive is suspicious and we should prompt the user for a
  // password for use in local decryption.
  optional bool is_suspicious_encrypted_archive = 21;

  // Reserved server-side fields.
  reserved 22;
  reserved 23;

  // List of DownloadVisualFeatures requested from the client, provided as a
  // list of indices into the `download_visual_features` advertised in the
  // ClientDownloadRequest. A `token` to use in the follow-up request must be
  // provided if there are any `visual_features_requested`.
  repeated int32 visual_features_requested = 24 [packed = true];
}

// The following protocol buffer holds the feedback report gathered
// from the user regarding the download.
message ClientDownloadReport {
  // The information of user who provided the feedback.
  // This is going to be useful for handling appeals.
  message UserInformation {
    optional string email = 1;
  }

  enum Reason {
    SHARE = 0;
    FALSE_POSITIVE = 1;
    APPEAL = 2;
  }

  // The type of feedback for this report.
  optional Reason reason = 1;

  // The original download ping
  optional ClientDownloadRequest download_request = 2;

  // Stores the information of the user who provided the feedback.
  optional UserInformation user_information = 3;

  // Unstructed comments provided by the user.
  optional bytes comment = 4;

  // The original download response sent from the verdict server.
  optional ClientDownloadResponse download_response = 5;
}

// This is used to send back upload status to the client after upload completion
message ClientUploadResponse {
  enum UploadStatus {
    // The upload was successful and a complete response can be expected
    SUCCESS = 0;

    // The upload was unsuccessful and the response is incomplete.
    UPLOAD_FAILURE = 1;
  }

  // Holds the upload status
  optional UploadStatus status = 1;

  // Holds the permalink where the results of scanning the binary are available
  optional string permalink = 2;
}

message ClientIncidentReport {
  message IncidentData {
    message TrackedPreferenceIncident {
      enum ValueState {
        UNKNOWN = 0;
        CLEARED = 1;
        WEAK_LEGACY_OBSOLETE = 2;
        CHANGED = 3;
        UNTRUSTED_UNKNOWN_VALUE = 4;
        BYPASS_CLEARED = 5;
        BYPASS_CHANGED = 6;
      }

      optional string path = 1;
      optional string atomic_value = 2;
      repeated string split_key = 3;
      optional ValueState value_state = 4;
    }

    message BinaryIntegrityIncident {
      optional string file_basename = 1;
      optional ClientDownloadRequest.SignatureInfo signature = 2;
      optional ClientDownloadRequest.ImageHeaders image_headers = 3;
      optional int32 sec_error = 4;

      message ContainedFile {
        optional string relative_path = 1;
        optional ClientDownloadRequest.SignatureInfo signature = 2;
        optional ClientDownloadRequest.ImageHeaders image_headers = 3;
      }
      repeated ContainedFile contained_file = 5;
    }

    message ResourceRequestIncident {
      enum Type {
        UNKNOWN = 0;
        TYPE_PATTERN = 3;
      }
      optional bytes digest = 1;
      optional string origin = 2;
      optional Type type = 3 [default = UNKNOWN];
    }

    message ServiceWorkerRegistrationIncident {
      // The service worker's scope url.
      optional string scope_url = 1;
      // The URLs used to import scripts by the service worker.
      repeated string import_script_url = 2;
    }

    optional int64 incident_time_msec = 1;
    optional TrackedPreferenceIncident tracked_preference = 2;
    optional BinaryIntegrityIncident binary_integrity = 3;
    // Note: skip tag 4,5,6 because they were previously used.
    reserved 4 to 6;
    optional ResourceRequestIncident resource_request = 7;
    // Note: skip tag 8 because it was previously used.
    reserved 8;
    // A ServiceWorkerRegistrationIncident is created for every service
    // worker on a ESB profile that sends notifications and has imported
    // scripts from a origin that is different from its scope URL. The
    // report is created and emitted from the Notification Telemetry Service.
    optional ServiceWorkerRegistrationIncident notification_import_script = 9;
  }

  repeated IncidentData incident = 1;

  message DownloadDetails {
    optional bytes token = 1;
    optional ClientDownloadRequest download = 2;
    optional int64 download_time_msec = 3;
    optional int64 open_time_msec = 4;
  }

  optional DownloadDetails download = 2;

  message EnvironmentData {
    message OS {
      optional string os_name = 1;
      optional string os_version = 2;

      message RegistryValue {
        optional string name = 1;
        optional uint32 type = 2;
        optional bytes data = 3;
      }

      message RegistryKey {
        optional string name = 1;
        repeated RegistryValue value = 2;
        repeated RegistryKey key = 3;
      }

      repeated RegistryKey registry_key = 3;

      optional bool is_enrolled_to_domain = 4;
    }
    optional OS os = 1;
    message Machine {
      optional string cpu_architecture = 1;
      optional string cpu_vendor = 2;
      optional uint32 cpuid = 3;
    }
    optional Machine machine = 2;
    message Process {
      optional string version = 1;
      repeated string OBSOLETE_dlls = 2;
      message Patch {
        optional string function = 1;
        optional string target_dll = 2;
      }
      repeated Patch patches = 3;
      message NetworkProvider {}
      repeated NetworkProvider network_providers = 4;
      enum Channel {
        CHANNEL_UNKNOWN = 0;
        CHANNEL_CANARY = 1;
        CHANNEL_DEV = 2;
        CHANNEL_BETA = 3;
        CHANNEL_STABLE = 4;
      }
      optional Channel chrome_update_channel = 5;
      optional int64 uptime_msec = 6;
      optional bool metrics_consent = 7;
      // Obsolete: extended consent is now required for incident reporting.
      optional bool OBSOLETE_extended_consent = 8;
      message Dll {
        enum Feature {
          UNKNOWN = 0;
          LSP = 1;
        }
        optional string path = 1;
        optional uint64 base_address = 2;
        optional uint32 length = 3;
        repeated Feature feature = 4;
        optional ClientDownloadRequest.ImageHeaders image_headers = 5;
      }
      repeated Dll dll = 9;
      repeated string blocklisted_dll = 10;
      message ModuleState {
        enum ModifiedState {
          UNKNOWN = 0;
          MODULE_STATE_UNKNOWN = 1;
          MODULE_STATE_UNMODIFIED = 2;
          MODULE_STATE_MODIFIED = 3;
        }
        optional string name = 1;
        optional ModifiedState modified_state = 2;
        repeated string OBSOLETE_modified_export = 3;

        message Modification {
          optional uint32 file_offset = 1;
          optional int32 byte_count = 2;
          optional bytes modified_bytes = 3;
          optional string export_name = 4;
        }
        repeated Modification modification = 4;
      }
      repeated ModuleState module_state = 11;
      // Obsolete: field trials no longer enable incident reporting.
      optional bool OBSOLETE_field_trial_participant = 12;
    }
    optional Process process = 3;
  }

  message ExtensionData {
    message ExtensionInfo {
      enum ExtensionState {
        STATE_UNKNOWN = 0;
        STATE_ENABLED = 1;
        STATE_DISABLED = 2;
        STATE_BLOCKLISTED = 3;
        STATE_BLOCKED = 4;
        STATE_TERMINATED = 5;
      }

      optional string id = 1;
      optional string version = 2;
      optional string name = 3;
      optional string description = 4;
      optional ExtensionState state = 5 [default = STATE_UNKNOWN];
      optional int32 type = 6;
      optional string update_url = 7;
      optional bool has_signature_validation = 8;
      optional bool signature_is_valid = 9;
      optional bool installed_by_custodian = 10;
      optional bool installed_by_default = 11;
      optional bool installed_by_oem = 12;
      optional bool from_bookmark = 13;
      optional bool from_webstore = 14;
      optional bool converted_from_user_script = 15;
      optional bool may_be_untrusted = 16;
      optional int64 install_time_msec = 17;
      optional int32 manifest_location_type = 18;
      optional string manifest = 19;
    }

    optional ExtensionInfo last_installed_extension = 1;
  }

  optional EnvironmentData environment = 3;

  // Population that the reporting user is part of.
  optional ChromeUserPopulation population = 7;

  optional ExtensionData extension_data = 8;

  message NonBinaryDownloadDetails {
    optional string file_type = 1;
    optional bytes url_spec_sha256 = 2;
    optional string host = 3;
    optional int64 length = 4;
  }

  optional NonBinaryDownloadDetails non_binary_download = 9;
}

message ClientIncidentResponse {
  optional bytes token = 1;
  optional bool download_requested = 2;

  message EnvironmentRequest {
    optional int32 dll_index = 1;
  }

  repeated EnvironmentRequest environment_requests = 3;
}

message DownloadMetadata {
  optional uint32 download_id = 1;

  optional ClientIncidentReport.DownloadDetails download = 2;
}

// A Detailed Safebrowsing Report from clients. Chrome safebrowsing reports are
// only sent by Chrome users who have opted into extended Safe Browsing.
// This proto is replacing ClientMalwareReportRequest.
// Next tag: 37
message ClientSafeBrowsingReportRequest {
  // Note: A lot of the "optional" fields would make sense to be
  // "required" instead.  However, having them as optional allows the
  // clients to send "stripped down" versions of the message in the
  // future, if we want to.

  // LINT.IfChange(ClientSafeBrowsingReportType)
  enum ReportType {
    UNKNOWN = 0;
    URL_PHISHING = 1;
    URL_MALWARE = 2;
    URL_UNWANTED = 3;
    URL_CLIENT_SIDE_PHISHING = 4;
    URL_CLIENT_SIDE_MALWARE = 5 [deprecated = true];
    DANGEROUS_DOWNLOAD_RECOVERY = 6;
    DANGEROUS_DOWNLOAD_WARNING = 7;
    DANGEROUS_DOWNLOAD_BY_API = 10;
    URL_PASSWORD_PROTECTION_PHISHING = 12;
    DANGEROUS_DOWNLOAD_OPENED = 13;
    AD_SAMPLE = 14;
    URL_SUSPICIOUS = 15;
    BILLING = 16;
    APK_DOWNLOAD = 17;
    BLOCKED_AD_REDIRECT = 19;
    BLOCKED_AD_POPUP = 20;
    HASH_PREFIX_REAL_TIME_EXPERIMENT = 21 [deprecated = true];
    PHISHY_SITE_INTERACTIONS = 22;
    WARNING_SHOWN = 23;
    NOTIFICATION_PERMISSION_ACCEPTED = 24;
    // This report is triggered if a download warning is not interacted in one
    // hour and automatically deleted by Chrome.
    DANGEROUS_DOWNLOAD_AUTO_DELETED = 25;
    // This report is triggered if a download warning is not interacted when
    // Chrome is closed.
    DANGEROUS_DOWNLOAD_PROFILE_CLOSED = 26;
    // This report is triggered by the sampled HPRT lookup where it showed
    // different verdicts from the URL real-time lookup.
    URL_REALTIME_AND_HASH_REALTIME_DISCREPANCY = 27;
    // Triggered by a redirect to an external app, either through an
    // external protocol scheme (e.g. mailto://) or an Intent.
    EXTERNAL_APP_REDIRECT = 28;
  }
  // LINT.ThenChange(//tools/metrics/histograms/metadata/safe_browsing/enums.xml:ClientSafeBrowsingReportType)

  message HTTPHeader {
    required bytes name = 1;
    optional bytes value = 2;
  }

  message HTTPRequest {
    message FirstLine {
      optional bytes verb = 1;
      optional bytes uri = 2;
      optional bytes version = 3;
    }

    optional FirstLine firstline = 1;
    repeated HTTPHeader headers = 2;
    optional bytes body = 3;

    // bodydigest and bodylength can be useful if the report does not
    // contain the body itself.
    optional bytes bodydigest = 4;  // 32-byte hex md5 digest of body.
    optional int32 bodylength = 5;  // length of body.
  }

  message HTTPResponse {
    message FirstLine {
      optional int32 code = 1;
      optional bytes message = 2;
      optional bytes version = 3;
    }

    optional FirstLine firstline = 1;
    repeated HTTPHeader headers = 2;
    optional bytes body = 3;
    optional bytes bodydigest = 4;  // 32-byte hex md5 digest of body.
    optional int32 bodylength = 5;  // length of body.
    optional bytes remote_ip = 6;   // IP of the server.
  }

  message Resource {
    required int32 id = 1;
    optional string url = 2;
    optional HTTPRequest request = 3;
    optional HTTPResponse response = 4;
    optional int32 parent_id = 5;
    repeated int32 child_ids = 6;
    optional string tag_name = 7;
  }

  optional ReportType type = 10;

  // Only set if ReportType is DANGEROUS_DOWNLOAD_RECOVERY,
  // DANGEROUS_DOWNLOAD_WARNING or DANGEROUS_DOWNLOAD_BY_API.
  optional ClientDownloadResponse.Verdict download_verdict = 11;

  // URL of the page in the address bar.
  optional string url = 1;

  // Must be set if the ReportType is not one of DANGEROUS_DOWNLOAD_RECOVERY,
  // DANGEROUS_DOWNLOAD_WARNING, DANGEROUS_DOWNLOAD_BY_API,
  // DANGEROUS_DOWNLOAD_OPENED, URL_PASSWORD_PROTECTION_PHISHING.
  optional string page_url = 2;

  optional string referrer_url = 3;

  repeated Resource resources = 4;

  // Contains the hierarchy of elements on the page (ie: the DOM). Some
  // elements can be Resources and will refer to the resources list (above).
  repeated HTMLElement dom = 16;

  // Whether the report is complete.
  optional bool complete = 5;

  // The ASN and country of the client IP. These fields are filled up by
  // csd_frontend
  repeated string client_asn = 6;
  optional string client_country = 7;

  // Whether user chose to proceed.
  optional bool did_proceed = 8;

  // Whether user visited this origin before.
  optional bool repeat_visit = 9;

  // The same token in ClientDownloadResponse or LoginReputationClientResponse.
  // This field is only set if its report type is DANGEROUS_DOWNLOAD_RECOVERY,
  // DANGEROUS_DOWNLOAD_WARNING, DANGEROUS_DOWNLOAD_BY_API,
  // URL_PASSWORD_PROTECTION_PHISHING, or DANGEROUS_DOWNLOAD_OPENED.
  optional bytes token = 15;

  enum SafeBrowsingUrlApiType {
    SAFE_BROWSING_URL_API_TYPE_UNSPECIFIED = 0;
    // Native implementation of Safe Browsing API v3 protocol.
    // Deprecated as of 2021-1. V3 protocol is not used anymore.
    PVER3_NATIVE = 1 [deprecated = true];
    // Native implementation of Safe Browsing API v4 protocol.
    PVER4_NATIVE = 2;
    // Android SafetyNet API.
    // https://developer.android.com/training/safetynet/safebrowsing.html
    ANDROID_SAFETYNET = 3 [deprecated = true];
    // Flywheel (data compression service).
    // Deprecated as of 2021-1. Data saver has been completely turned down.
    FLYWHEEL = 4 [deprecated = true];
    // Safe Browsing real time API.
    REAL_TIME = 5;
    // The Safe Browsing API v5 protocol hit in real time (non-Android).
    PVER5_NATIVE_REAL_TIME = 6;
    // The Android Safe Browsing API hit in real time.
    ANDROID_SAFEBROWSING_REAL_TIME = 7;
    // The Android Safe Browsing API hit in local blocklist.
    ANDROID_SAFEBROWSING = 8;
    // Client-side phishing.
    CLIENT_SIDE_DETECTION = 9;
  }

  // The information propagated from the client about various environment
  // variables including SDK version, Google Play Services version and so on.
  message SafeBrowsingClientProperties {
    optional string client_version = 1;
    optional int64 google_play_services_version = 2;
    optional bool is_instant_apps = 3;
    optional SafeBrowsingUrlApiType url_api_type = 4;
    // Server-side only fields.
    reserved 5;
    reserved 6;
    // Whether this is an asynchronous check. If true,
    // the user may see the page before they see a warning. See
    // go/async-sb-check-telemetry for details.
    optional bool is_async_check = 7;
    // Whether Google Play Protect is verifying apps.
    optional bool app_verification_enabled = 8;
  }
  optional SafeBrowsingClientProperties client_properties = 17;

  // Only set if report type is DANGEROUS_DOWNLOAD_OPENED.
  // True means user opened the folder where this download is in via browser.
  // False means user directly executed this download via download shelf or
  // other download UIs.
  optional bool show_download_in_folder = 18;

  // If we can find the complete referrer chain, this field will contains URLs
  // transitions from landing referrer to event in reverse chronological
  // order, i.e. event url comes first in this list, and landing referrer
  // comes last.
  repeated ReferrerChainEntry referrer_chain = 23;

  message DownloadItemInfo {
    // URL of the download payload.
    optional string url = 1;

    // This message contains various binary digests of the download payload.
    message Digests {
      optional bytes sha256 = 1;
    }
    optional Digests digests = 2;

    // This is the length in bytes of the download payload.
    optional int64 length = 3;

    // Name of the file where the download would be stored if the
    // download completes.  E.g., "bla.exe".
    optional string file_basename = 4;
  }

  optional DownloadItemInfo download_item_info = 24;

  // The SafetyNet ID of the Android device.
  // Deprecated, not launched.
  optional string safety_net_id = 25 [deprecated = true];

  optional ChromeUserPopulation population = 26;

  // Logs user actions on download warnings. This field is useful for analyzing
  // whether users pay attention to the warning, and why they decide to proceed
  // or discard.
  message DownloadWarningAction {
    // The warning surface this action is performed on. See
    // go/chrome-download-warning-surfaces for details.
    enum Surface {
      SURFACE_UNSPECIFIED = 0;
      // Applicable actions: DISCARD, OPEN_SUBPAGE
      BUBBLE_MAINPAGE = 1;
      // Applicable actions: PROCEED, DISCARD, DISMISS, CLOSE, BACK,
      // PROCEED_DEEP_SCAN, OPEN_LEARN_MORE_LINK, ACCEPT_DEEP_SCAN
      BUBBLE_SUBPAGE = 2;
      // Applicable actions: DISCARD, KEEP, PROCEED, ACCEPT_DEEP_SCAN
      DOWNLOADS_PAGE = 3;
      // Applicable actions: PROCEED, CANCEL
      DOWNLOAD_PROMPT = 4;
      // Applicable actions: OPEN_SUBPAGE
      // Note: This only covers ChromeOS Lacros v2 notifications. CLOSE should
      // also be logged, but is currently not.
      DOWNLOAD_NOTIFICATION = 5;
    }
    optional Surface surface = 1;

    enum Action {
      ACTION_UNSPECIFIED = 0;
      // The user clicks proceed, which means the user decides to bypass the
      // warning. This is a terminal action.
      PROCEED = 1;
      // The user clicks discard, which means the user decides to obey the
      // warning and the dangerous download is deleted from disk.
      DISCARD = 2;
      // The user has clicked the keep button on the surface, which causes
      // another surface (e.g. download prompt) to be displayed. This is not a
      // terminal action.
      KEEP = 3;
      // The user has clicked the close button on the surface.
      CLOSE = 4;
      // The user clicks cancel on the download prompt.
      CANCEL = 5;
      // The user has dismissed the bubble by clicking anywhere outside
      // the bubble.
      DISMISS = 6;
      // The user has clicked the back button on the bubble subpage to go back
      // to the bubble main page.
      BACK = 7;
      // The user has opened the download bubble subpage.
      OPEN_SUBPAGE = 8;
      // The user bypassed a deep scanning prompt
      PROCEED_DEEP_SCAN = 9;
      // The user clicks the learn more link on the bubble subpage.
      OPEN_LEARN_MORE_LINK = 10;
      // The user accepts starting a deep scan.
      ACCEPT_DEEP_SCAN = 11;
    }
    optional Action action = 2;

    // Whether the action is terminal (i.e. the warning disappears after this
    // action is performed).
    optional bool is_terminal_action = 3;

    // Time intervals between when the download warning is first shown and
    // when the user performs actions on that warning, measured on the
    // client-side by the same clock. If the same warning has shown multiple
    // times, the interval is anchored to the earliest warning. All intervals
    // are measured in milliseconds.
    optional int64 interval_msec = 4;
  }
  repeated DownloadWarningAction download_warning_actions = 27;

  message HashRealTimeExperimentDetails {
    option deprecated = true;

    enum ExperimentThreatType {
      SAFE_OR_OTHER = 0;  // This differs from the SafeBrowsing ThreatType.
      MALWARE = 1;
      PHISHING = 2;
      UNWANTED = 3;
      BILLING = 4;
    }
    message RealTimeDetails {
      // The threat type determined by the mechanism.
      optional ExperimentThreatType threat_type = 1;
      // Whether the global cache / high-confidence allowlist was matched, which
      // results in the mechanism falling back to a hash database lookup.
      optional bool matched_global_cache = 2;
      // The threat type determined by the mechanism using only the local cache
      // results. This may differ from the threat_type. Only populated if the
      // local real-time cache was checked. It should never be populated if
      // matched_global_cache = true. It is possible for this field to be safe
      // while threat_type is not if it's for the URL real-time check.
      optional ExperimentThreatType locally_cached_results_threat_type = 3;
    }
    // The threat type determined by the hash database mechanism.
    optional ExperimentThreatType hash_database_threat_type = 1;
    // Details associated with the URL real-time lookup mechanism.
    optional RealTimeDetails url_realtime_details = 2;
    // Details associated with the hash real-time lookup mechanism.
    optional RealTimeDetails hash_realtime_details = 3;
  }

  // Only populated for type = HASH_PREFIX_REAL_TIME_EXPERIMENT.
  optional HashRealTimeExperimentDetails hash_real_time_experiment_details = 28
      [deprecated = true];

  // The request destination of the |url| fetched. Added to better understand
  // the protection of cross-site warnings (i.e. warnings triggered when url and
  // page_url are different). See
  // https://fetch.spec.whatwg.org/#concept-request-destination for the
  // definition of each field.
  // go/skip-sb-images-css-font for details.
  enum UrlRequestDestination {
    REQUEST_DESTINATION_UNSPECIFIED = 0;
    // The destination is unknown or unset.
    EMPTY = 1;
    // <audio>
    AUDIO = 2;
    // audioWorklet.addModule()
    AUDIO_WORKLET = 3;
    // Mainframe URL. |url| and |page_url| should be the same in this case.
    DOCUMENT = 4;
    // <embed>
    EMBED = 5;
    // CSS' @font-face
    FONT = 6;
    // <frame>
    FRAME = 7;
    // <iframe>
    IFRAME = 8;
    // <img src>
    IMAGE = 9;
    // <link rel=manifest>
    MANIFEST = 10;
    // <object>
    OBJECT = 11;
    // CSS.paintWorklet.addModule()
    PAINT_WORKLET = 12;
    // CSP, NEL reports.
    REPORT = 13;
    // <script>, importScripts()
    SCRIPT = 14;
    // navigator.serviceWorker.register()
    SERVICE_WORKER = 15;
    // SharedWorker()
    SHARED_WORKER = 16;
    // <link rel=stylesheet>, CSS @import
    STYLE = 17;
    // <track>
    TRACK = 18;
    // <video>
    VIDEO = 19;
    // <script type=webbundle>
    WEB_BUNDLE = 20;
    // Worker()
    WORKER = 21;
    // <?xml-stylesheet>
    XSLT = 22;
    // <fencedframe src="example.com">
    FENCED_FRAME = 23;
    // Federated Credential Management requests
    WEB_IDENTITY = 24;
    // <link rel=dictionary>
    DICTIONARY = 25;
    // Speculation rules (Speculation-Rules: "..." header).
    SPECULATION_RULES = 26;
    // import "..." with { type: "json" }
    JSON = 27;
    // sharedStorage.createWorklet(), sharedStorage.worklet.addModule()
    SHARED_STORAGE_WORKLET = 28;
  }

  // Only populated for interstitial reports (URL_PHISHING, URL_MALWARE,
  // URL_UNWANTED and BILLING).
  optional UrlRequestDestination url_request_destination = 29;

  // Information about user interactions with an interstitial.
  message InterstitialInteraction {
    // Type of interaction with security interstitial.
    enum SecurityInterstitialInteraction {
      UNSPECIFIED = 0;
      // Decisions
      CMD_DONT_PROCEED = 1;
      CMD_PROCEED = 2;
      // Ways for user to get more information
      CMD_SHOW_MORE_SECTION = 3;
      CMD_OPEN_HELP_CENTER = 4;
      CMD_OPEN_DIAGNOSTIC = 5;
      // Primary button actions
      CMD_RELOAD = 6;
      CMD_OPEN_DATE_SETTINGS = 7;
      CMD_OPEN_LOGIN = 8;
      // Safe Browsing Extended Reporting
      CMD_DO_REPORT = 9;
      CMD_DONT_REPORT = 10;
      CMD_OPEN_REPORTING_PRIVACY = 11;
      CMD_OPEN_WHITEPAPER = 12;
      // Report a phishing error
      CMD_REPORT_PHISHING_ERROR = 13;
      // Open enhanced protection settings.
      CMD_OPEN_ENHANCED_PROTECTION_SETTINGS = 14;
      // Leave interstitial without making explicit UI decision.
      CMD_CLOSE_INTERSTITIAL_WITHOUT_UI = 15;
    }

    // Type of security interstitial interaction that occurred.
    optional SecurityInterstitialInteraction security_interstitial_interaction =
        1;

    // Number of interstitial interaction occurrences.
    optional int32 occurrence_count = 2;

    // Timestamp of first interstitial interaction occurrence.
    optional int64 first_interaction_timestamp_msec = 3;

    // Timestamp of last interstitial interaction occurrence.
    optional int64 last_interaction_timestamp_msec = 4;
  }

  // List of user interactions that the user performs with the interstitial.
  repeated InterstitialInteraction interstitial_interactions = 30;

  // Information about user interactions with a phishy site.
  message PhishySiteInteraction {
    // Type of interaction with phishy site.
    enum PhishySiteInteractionType {
      UNSPECIFIED = 0;
      // User interactions.
      PHISHY_CLICK_EVENT = 1;
      PHISHY_KEY_EVENT = 2;
      PHISHY_PASTE_EVENT = 3;
    }

    // Type of security interstitial interaction that occurred.
    optional PhishySiteInteractionType phishy_site_interaction_type = 1;

    // Number of phishy site interaction occurrences.
    optional int32 occurrence_count = 2;

    // Timestamp of first phishy site interaction occurrence.
    optional int64 first_interaction_timestamp_msec = 3;

    // Timestamp of last phishy site interaction occurrence.
    optional int64 last_interaction_timestamp_msec = 4;
  }

  // List of user interactions that the user performs with a phishy site.
  repeated PhishySiteInteraction phishy_site_interactions = 31;

  // Timestamp of when the warning was first shown to the user.
  optional int64 warning_shown_timestamp_msec = 32;

  // Information included in WARNING_SHOWN reports.
  message WarningShownInfo {
    // Type of warning UX shown to the user.
    enum WarningUXType {
      UNKNOWN = 0;
      PHISHING_INTERSTITIAL = 1;
      CLIENT_SIDE_PHISHING_INTERSTITIAL = 2;
      MALWARE_INTERSTITIAL = 3;
      UWS_INTERSTITIAL = 4;
      BILLING_INTERSTITIAL = 5;
      BINARY_MALWARE_DOWNLOAD_WARNING = 6;
    }
    optional WarningUXType warning_type = 1;

    // Data contains the hash value of the download and referrer URLs. Only set
    // in BINARY_MALWARE_DOWNLOAD_WARNING report.
    optional string post_data = 2;
  }

  optional WarningShownInfo warning_shown_info = 33;

  // Information included in NOTIFICATION_PERMISSION_ACCEPTED reports.
  message PermissionPromptInfo {
    // The request origin of the permission prompt.
    optional string origin = 1;

    // The amount of time the user spent on the permission prompt before
    // accepting the permission.
    optional int64 display_duration_sec = 2;
  }

  optional PermissionPromptInfo permission_prompt_info = 34;

  // Locale of the device, e.g. en, en_US.
  optional string locale = 35;

  // Information included in the URL real-time and hash real-time discrepancy
  // info reports.
  message UrlRealTimeAndHashRealTimeDiscrepancyInfo {
    enum LookupThreatType {
      SAFE_OR_OTHER = 0;
      MALWARE = 1;
      PHISHING = 2;
      UNWANTED = 3;
      BILLING = 4;
    }
    // The threat type determined by the hash realtime mechanism.
    optional LookupThreatType hash_realtime_threat_type = 1;
    // The threat type determined by the URL real-time mechanism.
    optional LookupThreatType url_realtime_threat_type = 2;
  }

  optional UrlRealTimeAndHashRealTimeDiscrepancyInfo
      url_real_time_and_hash_real_time_discrepancy_info = 36;
}

// An HTML Element on the page (eg: iframe, div, script, etc).
message HTMLElement {
  // Id of this element.
  optional int32 id = 1;

  // The tag type of this element (eg: iframe, div, script, etc).
  optional string tag = 2;

  // IDs of elements that are children of this element.
  repeated int32 child_ids = 3;

  // If this element represents a Resource then this is the id of the
  // Resource, which contains additional data about the Resource. Otherwise
  // unset.
  optional int32 resource_id = 5;

  // An Attribute of the element (eg: id, border, foo etc) and its value.
  message Attribute {
    optional string name = 1;
    optional string value = 2;
  }
  repeated Attribute attribute = 6;

  optional bytes inner_html = 7;
}

// Protobuf for Chrome extension webstore install request.
message ExtensionWebStoreInstallRequest {
  // If we can find the complete referrer chain, this field will contain URL
  // transitions from landing referrer to event in reverse chronological
  // order, i.e. event url comes first in this list, and landing referrer
  // comes last.
  // For Safe Browsing Extended Reporting, if the referrer
  // chain is empty or partially missing, we will add/append recent navigation
  // events to this list. The type of these entries will be RECENT_NAVIGATION.
  repeated ReferrerChainEntry referrer_chain = 1;

  // Options and metadata about the above referrer chain.
  optional ReferrerChainOptions referrer_chain_options = 2;
}

// Protobuf for uploading Chrome extension telemetry reports.
message ExtensionTelemetryReportRequest {
  // Information about the Chrome extension.
  message ExtensionInfo {
    enum Type {
      UNKNOWN_TYPE = 0;            // Unknown (hopefully never used)
      EXTENSION = 1;               // A browser extension
      THEME = 2;                   // A browser theme
      USER_SCRIPT = 3;             // An extension converted from a user script
      HOSTED_APP = 4;              // A hosted app
      LEGACY_PACKAGED_APP = 5;     // A (deprecated) v1 packaged app
      PLATFORM_APP = 6;            // A platform app
      SHARED_MODULE = 7;           // A shared module
      LOGIN_SCREEN_EXTENSION = 8;  // An extension running on the login screen
    }

    enum InstallLocation {
      UNKNOWN_LOCATION = 0;  // Unknown (hopefully never used)
      INTERNAL = 1;  // A crx file from the internal Extensions directory; most
                     // webstore-installed extensions fall into this category.
      EXTERNAL_PREF = 2;  // A crx file from an external directory (via prefs).
      EXTERNAL_REGISTRY = 3;  // A crx file from an external directory (via the
                              // Windows registry)
      UNPACKED = 4;   // An unpacked extension loaded from chrome://extensions.
      COMPONENT = 5;  // An internal component extension.
      EXTERNAL_PREF_DOWNLOAD = 6;    // A crx file from an external directory
                                     // (via prefs), downloaded from an update
                                     // URL.
      EXTERNAL_POLICY_DOWNLOAD = 7;  // A crx file from an external directory
                                     // (via admin policies), downloaded from an
                                     // update URL.
      COMMAND_LINE = 8;  // Loaded from the commandline (e.g. --load-extension).
      EXTERNAL_POLICY = 9;  // A crx file from an external directory (via admin
                            // policies), cached locally and installed from the
                            // cache.
      EXTERNAL_COMPONENT = 10;  // A component extension that was downloaded
                                // externally via an update url.
    }

    // The state of the extension as determined by SB blocklist, Omaha, or CRX
    // Telemetry server.
    enum BlocklistState {
      // The extension is not in the blocklist.
      NOT_BLOCKLISTED = 0;
      // The extension is malware.
      BLOCKLISTED_MALWARE = 1;
      // The extension has a serious security vulnerability.
      BLOCKLISTED_SECURITY_VULNERABILITY = 2;
      // The extension violated CWS policy.
      BLOCKLISTED_CWS_POLICY_VIOLATION = 3;
      // The extension is considered potentially unwanted.
      BLOCKLISTED_POTENTIALLY_UNWANTED = 4;
      // Used when we couldn't connect to server, e.g. when offline.
      BLOCKLISTED_UNKNOWN = 5;
    }

    // Installation policy for the extension, default is NO_POLICY if not
    // controlled by policy.
    enum InstallationPolicy {
      NO_POLICY = 0;                 // No policy for Extension.
      INSTALLATION_ALLOWED = 1;      // Extension can be installed.
      INSTALLATION_BLOCKED = 2;      // Extension cannot be installed.
      INSTALLATION_FORCED = 3;       // Extension will be installed
                                     // automatically and cannot be disabled.
      INSTALLATION_RECOMMENDED = 4;  // Extension will be installed
                                     // automatically but can be disabled.
      INSTALLATION_REMOVED = 5;      // Extension cannot be installed and will
                                     // be automatically removed.
    }

    optional string id = 1;
    optional string version = 2;
    optional string name = 3;
    // Version install time.
    optional int64 install_timestamp_msec = 4;
    // If the extension was installed by default when the profile was created.
    // These extensions are specified by Chrome.
    optional bool is_default_installed = 5;
    // If the extension was installed by an OEM. This differs from
    // "is_default_installed", since these extensions are specified by the OEM
    // rather than by Chrome. These are specified in a file that is created as
    // part of the creation of the Chrome image, and can be specific to
    // different OEMs.
    optional bool is_oem_installed = 6;
    // If the extension originated from the Chrome Web Store according to the
    // prefs. This differs from install_location, which specifies the location
    // on the user’s machine from where the install originated, but not
    // whether the extension is hosted in the store. For instance, sideloaded
    // extensions that are specified via ID in the registry are downloaded from
    // the store.
    optional bool is_from_store = 7;
    // If the extension automatically updates from the Chrome Web Store.
    optional bool updates_from_store = 8;
    // If the extension was created from a user script. This is distinct from
    // install_location, which specifies from where on the user’s machine
    // the install originated.
    optional bool is_converted_from_user_script = 9;
    optional Type type = 10;
    optional InstallLocation install_location = 11;
    // The state of the extension determined by a combination of SB blocklist,
    // Omaha, and CRX Telemetry service.
    optional BlocklistState blocklist_state = 12;
    // Bitmask of reason(s) the Chrome extension is disabled.
    // Bit positions are defined in extensions::disable_reason::DisableReason
    // (located in //extensions/browser/disable_reason.h)
    //
    // TODO(crbug.com/372186532): This field will be deprecated in favor of
    // disable_reasons_list field below.
    optional uint32 disable_reasons = 13;

    // Manifest.json file associated with the extension. Only populated for
    // off-store extensions.
    optional string manifest_json = 14;

    // Extension file names and hashes.
    message FileInfo {
      // Extension file name.
      optional string name = 1;
      // Extension file hash calculated with SHA256.
      optional bytes hash = 2;
    }

    // Only populated for off-store extensions.
    repeated FileInfo file_infos = 15;

    // The state of the extension determined by the CRX telemetry server only.
    optional BlocklistState telemetry_blocklist_state = 16;

    // Installation policy for the extension determined by enterprise policy.
    optional InstallationPolicy installation_policy = 17;

    // List of reasons for which the Chrome extension is disabled. The reason
    // values are defined in extensions::disable_reason::DisableReason (located
    // in //extensions/browser/disable_reason.h).
    repeated uint32 disable_reasons_list = 18;

    // Next available tag number: 19.
  }

  // Information about the various telemetry signals.
  message SignalInfo {
    // Data for one stack frame in a JS stack trace.
    message JSCallStackFrame {
      optional string function_name = 1;
      optional string script_name = 2;
      optional uint32 line = 3;
      optional uint32 column = 4;
    }
    // Data for a complete JS stack trace consisting of
    // multiple stack frames.
    // Used to send JS call stack contents for extensions API signals.
    message JSCallStack {
      repeated JSCallStackFrame frames = 1;
    }

    message TabsExecuteScriptInfo {
      message ScriptInfo {
        optional bytes hash = 1;
        // Number of times this script has been executed since
        // last report/browser start. This number is limited to
        // a configurable maximum (default max is 100).
        optional uint32 execution_count = 2;
      }
      repeated ScriptInfo scripts = 1;
      // The number of scripts that were not recorded because the max count was
      // exceeded.
      optional uint32 max_exceeded_script_count = 2;
    }

    optional TabsExecuteScriptInfo tabs_execute_script_info = 1;

    message RemoteHostContactedInfo {
      message RemoteHostInfo {
        enum ProtocolType {
          UNSPECIFIED = 0;
          HTTP_HTTPS = 1;
          WEBSOCKET = 2;
        }
        // Sanitized url (hostname only) of the contacted remote host.
        optional string url = 1;
        // Number of times this host has been contacted by the extension
        // using the `connection_protocol`.
        optional uint32 contact_count = 2;
        // Protocol used to make the connection.
        optional ProtocolType connection_protocol = 3;

        enum ContactInitiator {
          CONTACT_INITIATOR_UNSPECIFIED = 0;
          EXTENSION = 1;
          CONTENT_SCRIPT = 2;
        }
        optional ContactInitiator contacted_by = 4;
      }
      repeated RemoteHostInfo remote_host = 1;

      // True if the remote host info is collected from new interception point.
      optional bool collected_from_new_interception = 2;
    }

    optional RemoteHostContactedInfo remote_host_contacted_info = 2;

    // Cookies.getAll() API signal information.
    message CookiesGetAllInfo {
      // Include all API arguments used. See
      // https://developer.chrome.com/docs/extensions/reference/cookies/#method-getAll
      message GetAllArgsInfo {
        // Restricts the retrieved cookies to those whose domains match or are
        // subdomains of this one.
        optional string domain = 1;
        // Filters the cookies by name.
        optional string name = 2;
        // Restricts the retrieved cookies to those whose path exactly matches
        // this string.
        optional string path = 3;
        // Filters the cookies by their Secure property.
        optional bool secure = 4;
        // Deprecated.
        reserved 5;
        // The cookie store to retrieve cookies from. If omitted, the current
        // execution context's cookie store will be used.
        optional string store_id = 6;
        // Restricts the retrieved cookies to those that would match the given
        // URL.
        optional string url = 7;
        // Number of times this set of arguments has been used.
        optional uint32 count = 8;
        // Filters out session vs. persistent cookies.
        optional bool is_session = 9;
        // Up to 3 distinct JS callstacks when the API was invoked.
        repeated JSCallStack js_callstacks = 10;
      }

      repeated GetAllArgsInfo get_all_args_info = 1;

      // Number of argument sets collected in each signal is limited to a
      // maximum value (default 100). This field counts the number of argument
      // sets not recorded after limit is reached, and resets after each
      // generated report.
      optional uint32 max_exceeded_args_count = 2;
    }

    optional CookiesGetAllInfo cookies_get_all_info = 3;

    // Cookies.get() API signal information.
    message CookiesGetInfo {
      // Include all API arguments used. See
      // https://developer.chrome.com/docs/extensions/reference/cookies/#method-get
      message GetArgsInfo {
        // The name of the cookie to access.
        optional string name = 1;
        // The URL with which the cookie to access is associated.
        optional string url = 2;
        // The ID of the cookie store in which to look for the cookie. By
        // default, the current execution context's cookie store will be used.
        optional string store_id = 3;
        // Up to 3 distinct JS callstacks when the API was invoked.
        repeated JSCallStack js_callstacks = 4;

        // Number of times this set of arguments has been used.
        optional uint32 count = 8;
      }

      repeated GetArgsInfo get_args_info = 1;

      // Number of argument sets collected in each signal is limited to a
      // maximum value (default 100). This field counts the number of argument
      // sets not recorded after limit is reached, and resets after each
      // generated report.
      optional uint32 max_exceeded_args_count = 2;
    }

    optional CookiesGetInfo cookies_get_info = 4;

    // Potential Password Theft signal info.
    message PotentialPasswordTheftInfo {
      message RemoteHostInfo {
        option deprecated = true;

        // This information represents a host that an extension contacted within
        // a specific time window (currently 1 second) after a password-reuse
        // event was detected on one of that extension's pages.
        optional string remote_host_url = 1;
        // Number of times the remote host was contacted.
        optional uint32 count = 2;
      }
      message PasswordReuseInfo {
        // Domains from the Chrome password manager DB that are associated with
        // the same password as the one triggering this event.
        repeated string domains_matching_password = 1;

        // Whether the reused password is used for Chrome signin.
        optional bool is_chrome_signin_password = 2;

        message ReusedPasswordAccountType {
          // Whether the current reused password account is syncing.
          optional bool is_account_syncing = 1;

          enum AccountType {
            // User reused a password that is not a signed-in account, saved
            // password, or a non-GAIA enterprise account.
            UNKNOWN = 0;

            // User signed in with a dasher account.
            GSUITE = 1;

            // User signed in with @gmail.com, or @googlemail.com account.
            GMAIL = 2;

            // Password used for Enterprise login on an Enterprise login page.
            NON_GAIA_ENTERPRISE = 3;

            // Password saved in Chrome's password manager.
            SAVED_PASSWORD = 4;
          }
          optional AccountType account_type = 2;
        }

        optional ReusedPasswordAccountType reused_password_account_type = 3;

        // Number of times the password was reused in one of this extension's
        // pages.
        optional uint32 count = 4;
      }
      message RemoteHostData {
        // This information represents a host that an extension contacted within
        // a specific time window (currently 1 second) after a password-reuse
        // event was detected on one of that extension's pages.
        optional string remote_host_url = 1;
        // Number of times the remote host was contacted.
        optional uint32 count = 2;
      }
      // Deprecated.
      repeated RemoteHostInfo remote_hosts = 1 [deprecated = true];
      repeated PasswordReuseInfo reused_password_infos = 2;
      // The remote host(s) contacted within 1 second of at least one (but not
      // all) of the password reuse event(s) listed below.
      repeated RemoteHostData remote_hosts_data = 3;
    }

    optional PotentialPasswordTheftInfo potential_password_theft_info = 5;

    // declarativeNetRequest API signal information.
    message DeclarativeNetRequestInfo {
      // List of modifyHeaders/redirect rules collected in JSON form.
      repeated string rules = 1;

      // Number of rules collected in each signal is limited to a maximum value
      // (default: 50). This field counts the number of rules not recorded after
      // limit is reached, and resets after each generated report.
      optional uint32 max_exceeded_rules_count = 2;
    }

    optional DeclarativeNetRequestInfo declarative_net_request_info = 6;

    // chrome.tabs API signal information.
    message TabsApiInfo {
      enum ApiMethod {
        // Convenient default value, should not be used in real signal payload.
        API_METHOD_UNSPECIFIED = 0;
        CREATE = 1;
        UPDATE = 2;
        REMOVE = 3;
        CAPTURE_VISIBLE_TAB = 4;
      }
      message CallDetails {
        // The API method invoked.
        optional ApiMethod method = 1;
        // The URL to navigate the tab to. This field is only valid when
        // method is one of CREATE or UPDATE.
        optional string new_url = 2;
        // The currently committed URL for the tab. This field is only
        // valid when method is one of UPDATE, REMOVE, or CAPTURE_VISIBLE_TAB.
        optional string current_url = 3;
        // Number of times this call was made.
        optional uint32 count = 4;
        // Up to 3 distinct JS callstacks when the API was invoked.
        repeated JSCallStack js_callstacks = 5;
      }
      repeated CallDetails call_details = 1;
    }

    optional TabsApiInfo tabs_api_info = 7;

    // `declarativeNetRequest` action signal information. This signal is created
    // whenever a web request from Chrome matches a pattern specified in a
    // DeclarativeNetRequest rules configured for an extension.
    message DeclarativeNetRequestActionInfo {
      enum ActionType {
        // Convenient default value, should not be used in real signal payload.
        ACTION_TYPE_UNSPECIFIED = 0;
        REDIRECT = 1;
      }

      // Details about the action applied to a web request.
      message ActionDetails {
        // The action type applied.
        optional ActionType type = 1;
        // The URL from the web request.
        optional string request_url = 2;
        // The URL to which the web request will be redirected. This field is
        // only valid when the ActionType is REDIRECT.
        optional string redirect_url = 3;
        // Number of times this action was applied.
        optional uint32 count = 4;
      }
      repeated ActionDetails action_details = 1;
    }

    optional DeclarativeNetRequestActionInfo
        declarative_net_request_action_info = 8;
  }

  // Single report structure consists of all the signals observed for a
  // single extension.
  message Report {
    optional ExtensionInfo extension = 1;
    repeated SignalInfo signals = 2;
  }

  // Report creation timestamp.
  optional int64 creation_timestamp_msec = 1;
  repeated Report reports = 2;
  // The telemetry configuration version used to generate this report.
  // This field is not present if the default configuration is used.
  optional uint32 configuration_version = 3;
  // Tracks the current setting of developer mode in chrome://extensions page.
  optional bool developer_mode_enabled = 4;

  // DEPRECATED.
  // TODO(crbug.com/367327319): Clean up after new proto is live.
  enum ManagementAuthorityTrustworthiness {
    NONE = 0;           // No management authority found.
    LOW = 1;            // Local device management authority.
    TRUSTED = 2;        // Non-local management authority.
    FULLY_TRUSTED = 3;  // Cryptographically verifiable policy source
                        // e.g. CBCM, ChromeOS.
  }

  // DEPRECATED.
  // TODO(crbug.com/367327319): Clean up after new proto is live.
  optional ManagementAuthorityTrustworthiness
      management_authority_trustworthiness = 5 [deprecated = true];

  // Level of trustworthiness of a management authority entity.
  enum ManagementAuthority {
    MANAGEMENT_AUTHORITY_UNSPECIFIED = 0;
    MANAGEMENT_AUTHORITY_NONE = 1;     // No management authority found.
    MANAGEMENT_AUTHORITY_LOW = 2;      // Local device management authority.
    MANAGEMENT_AUTHORITY_TRUSTED = 3;  // Non-local management authority.
    MANAGEMENT_AUTHORITY_FULLY_TRUSTED =
        4;  // Cryptographically verifiable policy source
            // e.g. CBCM, ChromeOS.
  }

  // The highest level of management authority trustworthiness between the
  // platform and the browser.
  optional ManagementAuthority management_authority = 6;

  // Next available tag number: 7.
}

message ExtensionTelemetryReportResponse {
  message ExtensionParameters {
    optional string extension_id = 1;
    // Each bit represents whether the corresponding signal should be
    // enabled for the extension. Bit positions are defined by
    // `ExtensionSignalType` found in
    // `/extensions/extension_telemetry/extension_signal.h`
    optional uint64 signal_enable_mask = 2;
  }

  message Configuration {
    optional uint32 configuration_version = 1;
    optional uint32 reporting_interval_seconds = 2;
    optional uint32 writes_per_interval = 3;
    // Dynamic per-client signal parameters for their installed extensions.
    // This bitmask is generated by the telemetry server backend based on
    // the extension ignore and watch lists.
    repeated ExtensionParameters extension_parameters = 4;
  }
  optional Configuration configuration = 1;

  // Verdict returned by the telemetry server for any unsafe off-store
  // extensions installed.
  message OffstoreExtensionVerdict {
    enum OffstoreExtensionVerdictType {
      UNSPECIFIED = 0;
      NONE = 1;  // Used to unblocklisted an extension.
      MALWARE = 2;
    }

    optional string extension_id = 1;
    optional OffstoreExtensionVerdictType verdict_type = 2;
  }

  // Verdicts for unsafe off-store extensions.
  repeated OffstoreExtensionVerdict offstore_extension_verdicts = 2;
}