recaptchaenterprise.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.recaptchaenterprise.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/protobuf/timestamp.proto";
  21. option csharp_namespace = "Google.Cloud.RecaptchaEnterprise.V1Beta1";
  22. option go_package = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1;recaptchaenterprise";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "RecaptchaEnterpriseProto";
  25. option java_package = "com.google.recaptchaenterprise.v1beta1";
  26. option objc_class_prefix = "GCRE";
  27. option php_namespace = "Google\\Cloud\\RecaptchaEnterprise\\V1beta1";
  28. option ruby_package = "Google::Cloud::RecaptchaEnterprise::V1beta1";
  29. // Service to determine the likelihood an event is legitimate.
  30. service RecaptchaEnterpriseServiceV1Beta1 {
  31. option (google.api.default_host) = "recaptchaenterprise.googleapis.com";
  32. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  33. // Creates an Assessment of the likelihood an event is legitimate.
  34. rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) {
  35. option (google.api.http) = {
  36. post: "/v1beta1/{parent=projects/*}/assessments"
  37. body: "assessment"
  38. };
  39. option (google.api.method_signature) = "parent,assessment";
  40. }
  41. // Annotates a previously created Assessment to provide additional information
  42. // on whether the event turned out to be authentic or fradulent.
  43. rpc AnnotateAssessment(AnnotateAssessmentRequest) returns (AnnotateAssessmentResponse) {
  44. option (google.api.http) = {
  45. post: "/v1beta1/{name=projects/*/assessments/*}:annotate"
  46. body: "*"
  47. };
  48. option (google.api.method_signature) = "name,annotation";
  49. }
  50. }
  51. // The create assessment request message.
  52. message CreateAssessmentRequest {
  53. // Required. The name of the project in which the assessment will be created,
  54. // in the format "projects/{project_number}".
  55. string parent = 1 [
  56. (google.api.field_behavior) = REQUIRED,
  57. (google.api.resource_reference) = {
  58. type: "cloudresourcemanager.googleapis.com/Project"
  59. }
  60. ];
  61. // Required. The assessment details.
  62. Assessment assessment = 2 [(google.api.field_behavior) = REQUIRED];
  63. }
  64. // The request message to annotate an Assessment.
  65. message AnnotateAssessmentRequest {
  66. // Enum that represents the types of annotations.
  67. enum Annotation {
  68. // Default unspecified type.
  69. ANNOTATION_UNSPECIFIED = 0;
  70. // Provides information that the event turned out to be legitimate.
  71. LEGITIMATE = 1;
  72. // Provides information that the event turned out to be fraudulent.
  73. FRAUDULENT = 2;
  74. // Provides information that the event was related to a login event in which
  75. // the user typed the correct password. Deprecated, prefer indicating
  76. // CORRECT_PASSWORD through the reasons field instead.
  77. PASSWORD_CORRECT = 3 [deprecated = true];
  78. // Provides information that the event was related to a login event in which
  79. // the user typed the incorrect password. Deprecated, prefer indicating
  80. // INCORRECT_PASSWORD through the reasons field instead.
  81. PASSWORD_INCORRECT = 4 [deprecated = true];
  82. }
  83. // Enum that represents potential reasons for annotating an assessment.
  84. enum Reason {
  85. // Default unspecified reason.
  86. REASON_UNSPECIFIED = 0;
  87. // Indicates a chargeback issued for the transaction with no other details.
  88. // When possible, specify the type by using CHARGEBACK_FRAUD or
  89. // CHARGEBACK_DISPUTE instead.
  90. CHARGEBACK = 1;
  91. // Indicates a chargeback related to an alleged unauthorized transaction
  92. // from the cardholder's perspective (for example, the card number was
  93. // stolen).
  94. CHARGEBACK_FRAUD = 8;
  95. // Indicates a chargeback related to the cardholder having provided their
  96. // card details but allegedly not being satisfied with the purchase
  97. // (for example, misrepresentation, attempted cancellation).
  98. CHARGEBACK_DISPUTE = 9;
  99. // Indicates the transaction associated with the assessment is suspected of
  100. // being fraudulent based on the payment method, billing details, shipping
  101. // address or other transaction information.
  102. PAYMENT_HEURISTICS = 2;
  103. // Indicates that the user was served a 2FA challenge. An old assessment
  104. // with `ENUM_VALUES.INITIATED_TWO_FACTOR` reason that has not been
  105. // overwritten with `PASSED_TWO_FACTOR` is treated as an abandoned 2FA flow.
  106. // This is equivalent to `FAILED_TWO_FACTOR`.
  107. INITIATED_TWO_FACTOR = 7;
  108. // Indicates that the user passed a 2FA challenge.
  109. PASSED_TWO_FACTOR = 3;
  110. // Indicates that the user failed a 2FA challenge.
  111. FAILED_TWO_FACTOR = 4;
  112. // Indicates the user provided the correct password.
  113. CORRECT_PASSWORD = 5;
  114. // Indicates the user provided an incorrect password.
  115. INCORRECT_PASSWORD = 6;
  116. }
  117. // Required. The resource name of the Assessment, in the format
  118. // "projects/{project_number}/assessments/{assessment_id}".
  119. string name = 1 [
  120. (google.api.field_behavior) = REQUIRED,
  121. (google.api.resource_reference) = {
  122. type: "recaptchaenterprise.googleapis.com/Assessment"
  123. }
  124. ];
  125. // Optional. The annotation that will be assigned to the Event. This field can be left
  126. // empty to provide reasons that apply to an event without concluding whether
  127. // the event is legitimate or fraudulent.
  128. Annotation annotation = 2 [(google.api.field_behavior) = OPTIONAL];
  129. // Optional. Optional reasons for the annotation that will be assigned to the Event.
  130. repeated Reason reasons = 3 [(google.api.field_behavior) = OPTIONAL];
  131. // Optional. Optional unique stable hashed user identifier to apply to the assessment.
  132. // This is an alternative to setting the hashed_account_id in
  133. // CreateAssessment, for example when the account identifier is not yet known
  134. // in the initial request. It is recommended that the identifier is hashed
  135. // using hmac-sha256 with stable secret.
  136. bytes hashed_account_id = 4 [(google.api.field_behavior) = OPTIONAL];
  137. }
  138. // Empty response for AnnotateAssessment.
  139. message AnnotateAssessmentResponse {
  140. }
  141. // Password leak verification info.
  142. message PasswordLeakVerification {
  143. // Optional. Scrypt hash of the username+password that the customer wants to verify
  144. // against a known password leak.
  145. bytes hashed_user_credentials = 1 [(google.api.field_behavior) = OPTIONAL];
  146. // Output only. Whether or not the user's credentials are present in a known leak.
  147. bool credentials_leaked = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  148. // Optional. The username part of the user credentials for which we want to trigger a
  149. // leak check in canonicalized form. This is the same data used to create the
  150. // hashed_user_credentials on the customer side.
  151. string canonicalized_username = 3 [(google.api.field_behavior) = OPTIONAL];
  152. }
  153. // A recaptcha assessment resource.
  154. message Assessment {
  155. option (google.api.resource) = {
  156. type: "recaptchaenterprise.googleapis.com/Assessment"
  157. pattern: "projects/{project}/assessments/{assessment}"
  158. };
  159. // Reasons contributing to the risk analysis verdict.
  160. enum ClassificationReason {
  161. // Default unspecified type.
  162. CLASSIFICATION_REASON_UNSPECIFIED = 0;
  163. // Interactions matched the behavior of an automated agent.
  164. AUTOMATION = 1;
  165. // The event originated from an illegitimate environment.
  166. UNEXPECTED_ENVIRONMENT = 2;
  167. // Traffic volume from the event source is higher than normal.
  168. TOO_MUCH_TRAFFIC = 3;
  169. // Interactions with the site were significantly different than expected
  170. // patterns.
  171. UNEXPECTED_USAGE_PATTERNS = 4;
  172. // Too little traffic has been received from this site thus far to generate
  173. // quality risk analysis.
  174. LOW_CONFIDENCE_SCORE = 5;
  175. }
  176. // Output only. The resource name for the Assessment in the format
  177. // "projects/{project_number}/assessments/{assessment_id}".
  178. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  179. // The event being assessed.
  180. Event event = 2;
  181. // Output only. Legitimate event score from 0.0 to 1.0.
  182. // (1.0 means very likely legitimate traffic while 0.0 means very likely
  183. // non-legitimate traffic).
  184. float score = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  185. // Output only. Properties of the provided event token.
  186. TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  187. // Output only. Reasons contributing to the risk analysis verdict.
  188. repeated ClassificationReason reasons = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  189. // Information about the user's credentials used to check for leaks.
  190. // This feature is part of the Early Access Program (EAP). Exercise caution,
  191. // and do not deploy integrations based on this feature in a production
  192. // environment.
  193. PasswordLeakVerification password_leak_verification = 7;
  194. // Assessment returned by Account Defender when a hashed_account_id is
  195. // provided.
  196. AccountDefenderAssessment account_defender_assessment = 8;
  197. }
  198. message Event {
  199. // Optional. The user response token provided by the reCAPTCHA client-side integration
  200. // on your site.
  201. string token = 1 [(google.api.field_behavior) = OPTIONAL];
  202. // Optional. The site key that was used to invoke reCAPTCHA on your site and generate
  203. // the token.
  204. string site_key = 2 [(google.api.field_behavior) = OPTIONAL];
  205. // Optional. The user agent present in the request from the user's device related to
  206. // this event.
  207. string user_agent = 3 [(google.api.field_behavior) = OPTIONAL];
  208. // Optional. The IP address in the request from the user's device related to this event.
  209. string user_ip_address = 4 [(google.api.field_behavior) = OPTIONAL];
  210. // Optional. The expected action for this type of event. This should be the same action
  211. // provided at token generation time on client-side platforms already
  212. // integrated with recaptcha enterprise.
  213. string expected_action = 5 [(google.api.field_behavior) = OPTIONAL];
  214. // Optional. Optional unique stable hashed user identifier for the request. The
  215. // identifier should ideally be hashed using sha256 with stable secret.
  216. bytes hashed_account_id = 6 [(google.api.field_behavior) = OPTIONAL];
  217. }
  218. message TokenProperties {
  219. // Enum that represents the types of invalid token reasons.
  220. enum InvalidReason {
  221. // Default unspecified type.
  222. INVALID_REASON_UNSPECIFIED = 0;
  223. // If the failure reason was not accounted for.
  224. UNKNOWN_INVALID_REASON = 1;
  225. // The provided user verification token was malformed.
  226. MALFORMED = 2;
  227. // The user verification token had expired.
  228. EXPIRED = 3;
  229. // The user verification had already been seen.
  230. DUPE = 4;
  231. // The user verification token did not match the provided site key.
  232. // This may be a configuration error (e.g. development keys used in
  233. // production) or end users trying to use verification tokens from other
  234. // sites.
  235. SITE_MISMATCH = 5 [deprecated = true];
  236. // The user verification token was not present. It is a required input.
  237. MISSING = 6;
  238. // A retriable error (such as network failure) occurred on the browser.
  239. // Could easily be simulated by an attacker.
  240. BROWSER_ERROR = 7;
  241. }
  242. // Whether the provided user response token is valid. When valid = false, the
  243. // reason could be specified in invalid_reason or it could also be due to
  244. // a user failing to solve a challenge or a sitekey mismatch (i.e the sitekey
  245. // used to generate the token was different than the one specified in the
  246. // assessment).
  247. bool valid = 1;
  248. // Reason associated with the response when valid = false.
  249. InvalidReason invalid_reason = 2;
  250. // The timestamp corresponding to the generation of the token.
  251. google.protobuf.Timestamp create_time = 3;
  252. // The hostname of the page on which the token was generated.
  253. string hostname = 4;
  254. // Action name provided at token generation.
  255. string action = 5;
  256. }
  257. // Account Defender risk assessment.
  258. message AccountDefenderAssessment {
  259. // Labels returned by Account Defender for this request.
  260. enum AccountDefenderLabel {
  261. // Default unspecified type.
  262. ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0;
  263. // The request matches a known good profile for the user.
  264. PROFILE_MATCH = 1;
  265. // The request is potentially a suspicious login event and should be further
  266. // verified either via multi-factor authentication or another system.
  267. SUSPICIOUS_LOGIN_ACTIVITY = 2;
  268. // The request matched a profile that previously had suspicious account
  269. // creation behavior. This could mean this is a fake account.
  270. SUSPICIOUS_ACCOUNT_CREATION = 3;
  271. // The account in the request has a high number of related accounts. It does
  272. // not necessarily imply that the account is bad but could require
  273. // investigating.
  274. RELATED_ACCOUNTS_NUMBER_HIGH = 4;
  275. }
  276. // Labels for this request.
  277. repeated AccountDefenderLabel labels = 1;
  278. }