1- // Copyright 2020 Google LLC
1+ // Copyright 2021 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ service RecaptchaEnterpriseService {
4848 }
4949
5050 // 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 .
5252 rpc AnnotateAssessment (AnnotateAssessmentRequest ) returns (AnnotateAssessmentResponse ) {
5353 option (google.api.http ) = {
5454 post : "/v1/{name=projects/*/assessments/*}:annotate"
@@ -93,6 +93,28 @@ service RecaptchaEnterpriseService {
9393 delete : "/v1/{name=projects/*/keys/*}"
9494 };
9595 }
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+ }
96118}
97119
98120// The create assessment request message.
@@ -112,7 +134,7 @@ message CreateAssessmentRequest {
112134
113135// The request message to annotate an Assessment.
114136message AnnotateAssessmentRequest {
115- // Enum that reprensents the types of annotations.
137+ // Enum that represents the types of annotations.
116138 enum Annotation {
117139 // Default unspecified type.
118140 ANNOTATION_UNSPECIFIED = 0 ;
@@ -124,12 +146,47 @@ message AnnotateAssessmentRequest {
124146 FRAUDULENT = 2 ;
125147
126148 // 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 ];
129152
130153 // 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 ;
133190 }
134191
135192 // Required. The resource name of the Assessment, in the format
@@ -141,8 +198,13 @@ message AnnotateAssessmentRequest {
141198 }
142199 ];
143200
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 ];
146208}
147209
148210// Empty response for AnnotateAssessment.
@@ -195,7 +257,6 @@ message Event {
195257
196258// Risk analysis result for an event.
197259message RiskAnalysis {
198- // LINT.IfChange(classification_reason)
199260 // Reasons contributing to the risk analysis verdict.
200261 enum ClassificationReason {
201262 // Default unspecified type.
@@ -229,7 +290,6 @@ message RiskAnalysis {
229290}
230291
231292message TokenProperties {
232- // LINT.IfChange
233293 // Enum that represents the types of invalid token reasons.
234294 enum InvalidReason {
235295 // Default unspecified type.
@@ -249,6 +309,10 @@ message TokenProperties {
249309
250310 // The user verification token was not present.
251311 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 ;
252316 }
253317
254318 // Whether the provided user response token is valid. When valid = false, the
@@ -333,7 +397,7 @@ message UpdateKeyRequest {
333397 // Required. The key to update.
334398 Key key = 1 [(google.api.field_behavior ) = REQUIRED ];
335399
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
337401 // present, all fields will be updated.
338402 google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior ) = OPTIONAL ];
339403}
@@ -350,6 +414,54 @@ message DeleteKeyRequest {
350414 ];
351415}
352416
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+
353465// A key used to identify and configure applications (web and/or mobile) that
354466// use reCAPTCHA Enterprise.
355467message Key {
@@ -378,12 +490,43 @@ message Key {
378490 IOSKeySettings ios_settings = 5 ;
379491 }
380492
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">
382494 // Creating and managing labels</a>.
383- map <string , string > labels = 6 [ (google.api .field_behavior ) = OPTIONAL ] ;
495+ map <string , string > labels = 6 ;
384496
385497 // The timestamp corresponding to the creation of this Key.
386498 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 ;
387530}
388531
389532// Settings specific to keys that can be used by websites.
@@ -434,6 +577,7 @@ message WebKeySettings {
434577 repeated string allowed_domains = 1 ;
435578
436579 // Required. Whether this key can be used on AMP (Accelerated Mobile Pages) websites.
580+ // This can only be set for the SCORE integration type.
437581 bool allow_amp_traffic = 2 [(google.api.field_behavior ) = REQUIRED ];
438582
439583 // Required. Describes how this key is integrated with the website.
@@ -447,14 +591,58 @@ message WebKeySettings {
447591
448592// Settings specific to keys that can be used by Android apps.
449593message AndroidKeySettings {
594+ // If set to true, it means allowed_package_names will not be enforced.
595+ bool allow_all_package_names = 2 ;
596+
450597 // Android package names of apps allowed to use the key.
451598 // Example: 'com.companyname.appname'
452599 repeated string allowed_package_names = 1 ;
453600}
454601
455602// Settings specific to keys that can be used by iOS apps.
456603message IOSKeySettings {
604+ // If set to true, it means allowed_bundle_ids will not be enforced.
605+ bool allow_all_bundle_ids = 2 ;
606+
457607 // iOS bundle ids of apps allowed to use the key.
458608 // Example: 'com.companyname.productname.appname'
459609 repeated string allowed_bundle_ids = 1 ;
460610}
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