1
- // Copyright 2020 Google LLC
1
+ // Copyright 2021 Google LLC
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ service RecaptchaEnterpriseService {
48
48
}
49
49
50
50
// Annotates a previously created Assessment to provide additional information
51
- // on whether the event turned out to be authentic or fradulent .
51
+ // on whether the event turned out to be authentic or fraudulent .
52
52
rpc AnnotateAssessment (AnnotateAssessmentRequest ) returns (AnnotateAssessmentResponse ) {
53
53
option (google.api.http ) = {
54
54
post : "/v1/{name=projects/*/assessments/*}:annotate"
@@ -93,6 +93,28 @@ service RecaptchaEnterpriseService {
93
93
delete : "/v1/{name=projects/*/keys/*}"
94
94
};
95
95
}
96
+
97
+ // Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise.
98
+ // Once a key is migrated, it can be used from either product. SiteVerify
99
+ // requests are billed as CreateAssessment calls. You must be
100
+ // authenticated as one of the current owners of the reCAPTCHA Site Key, and
101
+ // your user must have the reCAPTCHA Enterprise Admin IAM role in the
102
+ // destination project.
103
+ rpc MigrateKey (MigrateKeyRequest ) returns (Key ) {
104
+ option (google.api.http ) = {
105
+ post : "/v1/{name=projects/*/keys/*}:migrate"
106
+ body : "*"
107
+ };
108
+ }
109
+
110
+ // Get some aggregated metrics for a Key. This data can be used to build
111
+ // dashboards.
112
+ rpc GetMetrics (GetMetricsRequest ) returns (Metrics ) {
113
+ option (google.api.http ) = {
114
+ get : "/v1/{name=projects/*/keys/*/metrics}"
115
+ };
116
+ option (google.api.method_signature ) = "name" ;
117
+ }
96
118
}
97
119
98
120
// The create assessment request message.
@@ -112,7 +134,7 @@ message CreateAssessmentRequest {
112
134
113
135
// The request message to annotate an Assessment.
114
136
message AnnotateAssessmentRequest {
115
- // Enum that reprensents the types of annotations.
137
+ // Enum that represents the types of annotations.
116
138
enum Annotation {
117
139
// Default unspecified type.
118
140
ANNOTATION_UNSPECIFIED = 0 ;
@@ -124,12 +146,47 @@ message AnnotateAssessmentRequest {
124
146
FRAUDULENT = 2 ;
125
147
126
148
// Provides information that the event was related to a login event in which
127
- // the user typed the correct password.
128
- PASSWORD_CORRECT = 3 ;
149
+ // the user typed the correct password. Deprecated, prefer indicating
150
+ // CORRECT_PASSWORD through the reasons field instead.
151
+ PASSWORD_CORRECT = 3 [deprecated = true ];
129
152
130
153
// Provides information that the event was related to a login event in which
131
- // the user typed the incorrect password.
132
- PASSWORD_INCORRECT = 4 ;
154
+ // the user typed the incorrect password. Deprecated, prefer indicating
155
+ // INCORRECT_PASSWORD through the reasons field instead.
156
+ PASSWORD_INCORRECT = 4 [deprecated = true ];
157
+ }
158
+
159
+ // Enum that represents potential reasons for annotating an assessment.
160
+ enum Reason {
161
+ // Default unspecified reason.
162
+ REASON_UNSPECIFIED = 0 ;
163
+
164
+ // Indicates a chargeback for fraud was issued for the transaction
165
+ // associated with the assessment.
166
+ CHARGEBACK = 1 ;
167
+
168
+ // Indicates the transaction associated with the assessment is suspected of
169
+ // being fraudulent based on the payment method, billing details, shipping
170
+ // address or other transaction information.
171
+ PAYMENT_HEURISTICS = 2 ;
172
+
173
+ // Indicates that the user was served a 2FA challenge. An old assessment
174
+ // with `ENUM_VALUES.INITIATED_TWO_FACTOR` reason that has not been
175
+ // overwritten with `PASSED_TWO_FACTOR` is treated as an abandoned 2FA flow.
176
+ // This is equivalent to `FAILED_TWO_FACTOR`.
177
+ INITIATED_TWO_FACTOR = 7 ;
178
+
179
+ // Indicates that the user passed a 2FA challenge.
180
+ PASSED_TWO_FACTOR = 3 ;
181
+
182
+ // Indicates that the user failed a 2FA challenge.
183
+ FAILED_TWO_FACTOR = 4 ;
184
+
185
+ // Indicates the user provided the correct password.
186
+ CORRECT_PASSWORD = 5 ;
187
+
188
+ // Indicates the user provided an incorrect password.
189
+ INCORRECT_PASSWORD = 6 ;
133
190
}
134
191
135
192
// Required. The resource name of the Assessment, in the format
@@ -141,8 +198,13 @@ message AnnotateAssessmentRequest {
141
198
}
142
199
];
143
200
144
- // Required. The annotation that will be assigned to the Event.
145
- Annotation annotation = 2 [(google.api.field_behavior ) = REQUIRED ];
201
+ // Optional. The annotation that will be assigned to the Event. This field can be left
202
+ // empty to provide reasons that apply to an event without concluding whether
203
+ // the event is legitimate or fraudulent.
204
+ Annotation annotation = 2 [(google.api.field_behavior ) = OPTIONAL ];
205
+
206
+ // Optional. Optional reasons for the annotation that will be assigned to the Event.
207
+ repeated Reason reasons = 3 [(google.api.field_behavior ) = OPTIONAL ];
146
208
}
147
209
148
210
// Empty response for AnnotateAssessment.
@@ -195,7 +257,6 @@ message Event {
195
257
196
258
// Risk analysis result for an event.
197
259
message RiskAnalysis {
198
- // LINT.IfChange(classification_reason)
199
260
// Reasons contributing to the risk analysis verdict.
200
261
enum ClassificationReason {
201
262
// Default unspecified type.
@@ -229,7 +290,6 @@ message RiskAnalysis {
229
290
}
230
291
231
292
message TokenProperties {
232
- // LINT.IfChange
233
293
// Enum that represents the types of invalid token reasons.
234
294
enum InvalidReason {
235
295
// Default unspecified type.
@@ -249,6 +309,10 @@ message TokenProperties {
249
309
250
310
// The user verification token was not present.
251
311
MISSING = 5 ;
312
+
313
+ // A retriable error (such as network failure) occurred on the browser.
314
+ // Could easily be simulated by an attacker.
315
+ BROWSER_ERROR = 6 ;
252
316
}
253
317
254
318
// Whether the provided user response token is valid. When valid = false, the
@@ -333,7 +397,7 @@ message UpdateKeyRequest {
333
397
// Required. The key to update.
334
398
Key key = 1 [(google.api.field_behavior ) = REQUIRED ];
335
399
336
- // Optional. The mask to control which field of the key get updated. If the mask is not
400
+ // Optional. The mask to control which fields of the key get updated. If the mask is not
337
401
// present, all fields will be updated.
338
402
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior ) = OPTIONAL ];
339
403
}
@@ -350,6 +414,54 @@ message DeleteKeyRequest {
350
414
];
351
415
}
352
416
417
+ // The migrate key request message.
418
+ message MigrateKeyRequest {
419
+ // Required. The name of the key to be migrated, in the format
420
+ // "projects/{project}/keys/{key}".
421
+ string name = 1 [
422
+ (google.api.field_behavior ) = REQUIRED ,
423
+ (google.api.resource_reference ) = {
424
+ type : "recaptchaenterprise.googleapis.com/Key"
425
+ }
426
+ ];
427
+ }
428
+
429
+ // The get metrics request message.
430
+ message GetMetricsRequest {
431
+ // Required. The name of the requested metrics, in the format
432
+ // "projects/{project}/keys/{key}/metrics".
433
+ string name = 1 [
434
+ (google.api.field_behavior ) = REQUIRED ,
435
+ (google.api.resource_reference ) = {
436
+ type : "recaptchaenterprise.googleapis.com/Metrics"
437
+ }
438
+ ];
439
+ }
440
+
441
+ // Metrics for a single Key.
442
+ message Metrics {
443
+ option (google.api.resource ) = {
444
+ type : "recaptchaenterprise.googleapis.com/Metrics"
445
+ pattern : "projects/{project}/keys/{key}/metrics"
446
+ };
447
+
448
+ // Output only. The name of the metrics, in the format
449
+ // "projects/{project}/keys/{key}/metrics".
450
+ string name = 4 [(google.api.field_behavior ) = OUTPUT_ONLY ];
451
+
452
+ // Inclusive start time aligned to a day (UTC).
453
+ google.protobuf.Timestamp start_time = 1 ;
454
+
455
+ // Metrics will be continuous and in order by dates, and in the granularity
456
+ // of day. All Key types should have score-based data.
457
+ repeated ScoreMetrics score_metrics = 2 ;
458
+
459
+ // Metrics will be continuous and in order by dates, and in the granularity
460
+ // of day. Only challenge-based keys (CHECKBOX, INVISIBLE), will have
461
+ // challenge-based data.
462
+ repeated ChallengeMetrics challenge_metrics = 3 ;
463
+ }
464
+
353
465
// A key used to identify and configure applications (web and/or mobile) that
354
466
// use reCAPTCHA Enterprise.
355
467
message Key {
@@ -378,12 +490,43 @@ message Key {
378
490
IOSKeySettings ios_settings = 5 ;
379
491
}
380
492
381
- // Optional. See <a href="https://cloud.google.com/recaptcha-enterprise/docs/labels">
493
+ // See <a href="https://cloud.google.com/recaptcha-enterprise/docs/labels">
382
494
// Creating and managing labels</a>.
383
- map <string , string > labels = 6 [ (google.api .field_behavior ) = OPTIONAL ] ;
495
+ map <string , string > labels = 6 ;
384
496
385
497
// The timestamp corresponding to the creation of this Key.
386
498
google.protobuf.Timestamp create_time = 7 ;
499
+
500
+ // Options for user acceptance testing.
501
+ TestingOptions testing_options = 9 ;
502
+ }
503
+
504
+ // Options for user acceptance testing.
505
+ message TestingOptions {
506
+ // Enum that represents the challenge option for challenge-based (CHECKBOX,
507
+ // INVISIBLE) testing keys.
508
+ enum TestingChallenge {
509
+ // Perform the normal risk analysis and return either nocaptcha or a
510
+ // challenge depending on risk and trust factors.
511
+ TESTING_CHALLENGE_UNSPECIFIED = 0 ;
512
+
513
+ // Challenge requests for this key will always return a nocaptcha, which
514
+ // does not require a solution.
515
+ NOCAPTCHA = 1 ;
516
+
517
+ // Challenge requests for this key will always return an unsolvable
518
+ // challenge.
519
+ UNSOLVABLE_CHALLENGE = 2 ;
520
+ }
521
+
522
+ // All assessments for this Key will return this score. Must be between 0
523
+ // (likely not legitimate) and 1 (likely legitimate) inclusive.
524
+ float testing_score = 1 ;
525
+
526
+ // For challenge-based keys only (CHECKBOX, INVISIBLE), all challenge requests
527
+ // for this site will return nocaptcha if NOCAPTCHA, or an unsolvable
528
+ // challenge if CHALLENGE.
529
+ TestingChallenge testing_challenge = 2 ;
387
530
}
388
531
389
532
// Settings specific to keys that can be used by websites.
@@ -434,6 +577,7 @@ message WebKeySettings {
434
577
repeated string allowed_domains = 1 ;
435
578
436
579
// Required. Whether this key can be used on AMP (Accelerated Mobile Pages) websites.
580
+ // This can only be set for the SCORE integration type.
437
581
bool allow_amp_traffic = 2 [(google.api.field_behavior ) = REQUIRED ];
438
582
439
583
// Required. Describes how this key is integrated with the website.
@@ -447,14 +591,58 @@ message WebKeySettings {
447
591
448
592
// Settings specific to keys that can be used by Android apps.
449
593
message AndroidKeySettings {
594
+ // If set to true, it means allowed_package_names will not be enforced.
595
+ bool allow_all_package_names = 2 ;
596
+
450
597
// Android package names of apps allowed to use the key.
451
598
// Example: 'com.companyname.appname'
452
599
repeated string allowed_package_names = 1 ;
453
600
}
454
601
455
602
// Settings specific to keys that can be used by iOS apps.
456
603
message IOSKeySettings {
604
+ // If set to true, it means allowed_bundle_ids will not be enforced.
605
+ bool allow_all_bundle_ids = 2 ;
606
+
457
607
// iOS bundle ids of apps allowed to use the key.
458
608
// Example: 'com.companyname.productname.appname'
459
609
repeated string allowed_bundle_ids = 1 ;
460
610
}
611
+
612
+ // Score distribution.
613
+ message ScoreDistribution {
614
+ // Map key is score value multiplied by 100. The scores are discrete values
615
+ // between [0, 1]. The maximum number of buckets is on order of a few dozen,
616
+ // but typically much lower (ie. 10).
617
+ map <int32 , int64 > score_buckets = 1 ;
618
+ }
619
+
620
+ // Metrics related to scoring.
621
+ message ScoreMetrics {
622
+ // Aggregated score metrics for all traffic.
623
+ ScoreDistribution overall_metrics = 1 ;
624
+
625
+ // Action-based metrics. The map key is the action name which specified by the
626
+ // site owners at time of the "execute" client-side call.
627
+ // Populated only for SCORE keys.
628
+ map <string , ScoreDistribution > action_metrics = 2 ;
629
+ }
630
+
631
+ // Metrics related to challenges.
632
+ message ChallengeMetrics {
633
+ // Count of reCAPTCHA checkboxes or badges rendered. This is mostly equivalent
634
+ // to a count of pageloads for pages that include reCAPTCHA.
635
+ int64 pageload_count = 1 ;
636
+
637
+ // Count of nocaptchas (successful verification without a challenge) issued.
638
+ int64 nocaptcha_count = 2 ;
639
+
640
+ // Count of submitted challenge solutions that were incorrect or otherwise
641
+ // deemed suspicious such that a subsequent challenge was triggered.
642
+ int64 failed_count = 3 ;
643
+
644
+ // Count of nocaptchas (successful verification without a challenge) plus
645
+ // submitted challenge solutions that were correct and resulted in
646
+ // verification.
647
+ int64 passed_count = 4 ;
648
+ }
0 commit comments