Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit 2099c50

Browse files
gcf-owl-bot[bot]Takashi Matsuo
and
Takashi Matsuo
authored
feat: add reCAPTCHA Enterprise account defender API methods (#328)
* feat: add reCAPTCHA Enterprise account defender API methods This cl adds the following API methods to support the Preview release of reCAPTCHA Enterprise account defender: ListRelatedAccountGroups, ListRelatedAccountGroupMemberships, and SearchRelatedAccountGroupMemberships. Additionally it modifies the existing createAssessment API method to add a new hashed_account_id parameter along with AccountDefenderAssessment return value. PiperOrigin-RevId: 407130991 Source-Link: googleapis/googleapis@d58e602 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d1b97bf27608e42b5324f65916b16986d855e1b9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDFiOTdiZjI3NjA4ZTQyYjUzMjRmNjU5MTZiMTY5ODZkODU1ZTFiOSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: change supported node version Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Takashi Matsuo <[email protected]>
1 parent c2b1926 commit 2099c50

29 files changed

+7015
-16
lines changed

protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto

+228-7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,31 @@ service RecaptchaEnterpriseService {
115115
};
116116
option (google.api.method_signature) = "name";
117117
}
118+
119+
// List groups of related accounts.
120+
rpc ListRelatedAccountGroups(ListRelatedAccountGroupsRequest) returns (ListRelatedAccountGroupsResponse) {
121+
option (google.api.http) = {
122+
get: "/v1/{parent=projects/*}/relatedaccountgroups"
123+
};
124+
option (google.api.method_signature) = "parent";
125+
}
126+
127+
// Get the memberships in a group of related accounts.
128+
rpc ListRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest) returns (ListRelatedAccountGroupMembershipsResponse) {
129+
option (google.api.http) = {
130+
get: "/v1/{parent=projects/*/relatedaccountgroups/*}/memberships"
131+
};
132+
option (google.api.method_signature) = "parent";
133+
}
134+
135+
// Search group memberships related to a given account.
136+
rpc SearchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest) returns (SearchRelatedAccountGroupMembershipsResponse) {
137+
option (google.api.http) = {
138+
post: "/v1/{parent=projects/*}/relatedaccountgroupmemberships:search"
139+
body: "*"
140+
};
141+
option (google.api.method_signature) = "parent,hashed_account_id";
142+
}
118143
}
119144

120145
// The create assessment request message.
@@ -205,6 +230,13 @@ message AnnotateAssessmentRequest {
205230

206231
// Optional. Optional reasons for the annotation that will be assigned to the Event.
207232
repeated Reason reasons = 3 [(google.api.field_behavior) = OPTIONAL];
233+
234+
// Optional. Optional unique stable hashed user identifier to apply to the assessment.
235+
// This is an alternative to setting the hashed_account_id in
236+
// CreateAssessment, for example when the account identifier is not yet known
237+
// in the initial request. It is recommended that the identifier is hashed
238+
// using hmac-sha256 with stable secret.
239+
bytes hashed_account_id = 4 [(google.api.field_behavior) = OPTIONAL];
208240
}
209241

210242
// Empty response for AnnotateAssessment.
@@ -231,6 +263,10 @@ message Assessment {
231263

232264
// Output only. Properties of the provided event token.
233265
TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
266+
267+
// Assessment returned by Account Defender when a hashed_account_id is
268+
// provided.
269+
AccountDefenderAssessment account_defender_assessment = 6;
234270
}
235271

236272
message Event {
@@ -253,6 +289,10 @@ message Event {
253289
// provided at token generation time on client-side platforms already
254290
// integrated with recaptcha enterprise.
255291
string expected_action = 5 [(google.api.field_behavior) = OPTIONAL];
292+
293+
// Optional. Optional unique stable hashed user identifier for the request. The
294+
// identifier should ideally be hashed using sha256 with stable secret.
295+
bytes hashed_account_id = 6 [(google.api.field_behavior) = OPTIONAL];
256296
}
257297

258298
// Risk analysis result for an event.
@@ -335,6 +375,34 @@ message TokenProperties {
335375
string action = 5;
336376
}
337377

378+
// Account Defender risk assessment.
379+
message AccountDefenderAssessment {
380+
// Labels returned by Account Defender for this request.
381+
enum AccountDefenderLabel {
382+
// Default unspecified type.
383+
ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0;
384+
385+
// The request matches a known good profile for the user.
386+
PROFILE_MATCH = 1;
387+
388+
// The request is potentially a suspicious login event and should be further
389+
// verified either via multi-factor authentication or another system.
390+
SUSPICIOUS_LOGIN_ACTIVITY = 2;
391+
392+
// The request matched a profile that previously had suspicious account
393+
// creation behavior. This could mean this is a fake account.
394+
SUSPICIOUS_ACCOUNT_CREATION = 3;
395+
396+
// The account in the request has a high number of related accounts. It does
397+
// not necessarily imply that the account is bad but could require
398+
// investigating.
399+
RELATED_ACCOUNTS_NUMBER_HIGH = 4;
400+
}
401+
402+
// Labels for this request.
403+
repeated AccountDefenderLabel labels = 1;
404+
}
405+
338406
// The create key request message.
339407
message CreateKeyRequest {
340408
// Required. The name of the project in which the key will be created, in the
@@ -510,11 +578,11 @@ message TestingOptions {
510578
// challenge depending on risk and trust factors.
511579
TESTING_CHALLENGE_UNSPECIFIED = 0;
512580

513-
// Challenge requests for this key will always return a nocaptcha, which
581+
// Challenge requests for this key always return a nocaptcha, which
514582
// does not require a solution.
515583
NOCAPTCHA = 1;
516584

517-
// Challenge requests for this key will always return an unsolvable
585+
// Challenge requests for this key always return an unsolvable
518586
// challenge.
519587
UNSOLVABLE_CHALLENGE = 2;
520588
}
@@ -576,9 +644,9 @@ message WebKeySettings {
576644
// Examples: 'example.com' or 'subdomain.example.com'
577645
repeated string allowed_domains = 1;
578646

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.
581-
bool allow_amp_traffic = 2 [(google.api.field_behavior) = REQUIRED];
647+
// If set to true, the key can be used on AMP (Accelerated Mobile Pages)
648+
// websites. This is supported only for the SCORE integration type.
649+
bool allow_amp_traffic = 2;
582650

583651
// Required. Describes how this key is integrated with the website.
584652
IntegrationType integration_type = 4 [(google.api.field_behavior) = REQUIRED];
@@ -591,7 +659,7 @@ message WebKeySettings {
591659

592660
// Settings specific to keys that can be used by Android apps.
593661
message AndroidKeySettings {
594-
// If set to true, it means allowed_package_names will not be enforced.
662+
// If set to true, allowed_package_names are not enforced.
595663
bool allow_all_package_names = 2;
596664

597665
// Android package names of apps allowed to use the key.
@@ -601,7 +669,7 @@ message AndroidKeySettings {
601669

602670
// Settings specific to keys that can be used by iOS apps.
603671
message IOSKeySettings {
604-
// If set to true, it means allowed_bundle_ids will not be enforced.
672+
// If set to true, allowed_bundle_ids are not enforced.
605673
bool allow_all_bundle_ids = 2;
606674

607675
// iOS bundle ids of apps allowed to use the key.
@@ -646,3 +714,156 @@ message ChallengeMetrics {
646714
// verification.
647715
int64 passed_count = 4;
648716
}
717+
718+
// The request message to list memberships in a related account group.
719+
message ListRelatedAccountGroupMembershipsRequest {
720+
// Required. The resource name for the related account group in the format
721+
// `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`.
722+
string parent = 1 [
723+
(google.api.field_behavior) = REQUIRED,
724+
(google.api.resource_reference) = {
725+
child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership"
726+
}
727+
];
728+
729+
// Optional. The maximum number of accounts to return. The service may return fewer than
730+
// this value.
731+
// If unspecified, at most 50 accounts will be returned.
732+
// The maximum value is 1000; values above 1000 will be coerced to 1000.
733+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
734+
735+
// Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships`
736+
// call.
737+
//
738+
// When paginating, all other parameters provided to
739+
// `ListRelatedAccountGroupMemberships` must match the call that provided the
740+
// page token.
741+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
742+
}
743+
744+
// The response to a `ListRelatedAccountGroupMemberships` call.
745+
message ListRelatedAccountGroupMembershipsResponse {
746+
// The memberships listed by the query.
747+
repeated RelatedAccountGroupMembership related_account_group_memberships = 1;
748+
749+
// A token, which can be sent as `page_token` to retrieve the next page.
750+
// If this field is omitted, there are no subsequent pages.
751+
string next_page_token = 2;
752+
}
753+
754+
// The request message to list related account groups.
755+
message ListRelatedAccountGroupsRequest {
756+
// Required. The name of the project to list related account groups from, in the format
757+
// "projects/{project}".
758+
string parent = 1 [
759+
(google.api.field_behavior) = REQUIRED,
760+
(google.api.resource_reference) = {
761+
child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup"
762+
}
763+
];
764+
765+
// Optional. The maximum number of groups to return. The service may return fewer than
766+
// this value.
767+
// If unspecified, at most 50 groups will be returned.
768+
// The maximum value is 1000; values above 1000 will be coerced to 1000.
769+
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
770+
771+
// Optional. A page token, received from a previous `ListRelatedAccountGroups` call.
772+
// Provide this to retrieve the subsequent page.
773+
//
774+
// When paginating, all other parameters provided to
775+
// `ListRelatedAccountGroups` must match the call that provided the page
776+
// token.
777+
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
778+
}
779+
780+
// The response to a `ListRelatedAccountGroups` call.
781+
message ListRelatedAccountGroupsResponse {
782+
// The groups of related accounts listed by the query.
783+
repeated RelatedAccountGroup related_account_groups = 1;
784+
785+
// A token, which can be sent as `page_token` to retrieve the next page.
786+
// If this field is omitted, there are no subsequent pages.
787+
string next_page_token = 2;
788+
}
789+
790+
// The request message to search related account group memberships.
791+
message SearchRelatedAccountGroupMembershipsRequest {
792+
// Required. The name of the project to search related account group memberships from,
793+
// in the format "projects/{project}".
794+
string parent = 1 [
795+
(google.api.field_behavior) = REQUIRED,
796+
(google.api.resource_reference) = {
797+
child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership"
798+
}
799+
];
800+
801+
// Optional. The unique stable hashed user identifier we should search connections to.
802+
// The identifier should correspond to a `hashed_account_id` provided in a
803+
// previous CreateAssessment or AnnotateAssessment call.
804+
bytes hashed_account_id = 2 [(google.api.field_behavior) = OPTIONAL];
805+
806+
// Optional. The maximum number of groups to return. The service may return fewer than
807+
// this value.
808+
// If unspecified, at most 50 groups will be returned.
809+
// The maximum value is 1000; values above 1000 will be coerced to 1000.
810+
int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
811+
812+
// Optional. A page token, received from a previous
813+
// `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the
814+
// subsequent page.
815+
//
816+
// When paginating, all other parameters provided to
817+
// `SearchRelatedAccountGroupMemberships` must match the call that provided
818+
// the page token.
819+
string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
820+
}
821+
822+
// The response to a `SearchRelatedAccountGroupMemberships` call.
823+
message SearchRelatedAccountGroupMembershipsResponse {
824+
// The queried memberships.
825+
repeated RelatedAccountGroupMembership related_account_group_memberships = 1;
826+
827+
// A token, which can be sent as `page_token` to retrieve the next page.
828+
// If this field is omitted, there are no subsequent pages.
829+
string next_page_token = 2;
830+
}
831+
832+
// A membership in a group of related accounts.
833+
message RelatedAccountGroupMembership {
834+
option (google.api.resource) = {
835+
type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership"
836+
pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}"
837+
};
838+
839+
// Required. The resource name for this membership in the format
840+
// `projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}`.
841+
string name = 1 [
842+
(google.api.field_behavior) = REQUIRED,
843+
(google.api.resource_reference) = {
844+
type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership"
845+
}
846+
];
847+
848+
// The unique stable hashed user identifier of the member. The identifier
849+
// corresponds to a `hashed_account_id` provided in a previous
850+
// CreateAssessment or AnnotateAssessment call.
851+
bytes hashed_account_id = 2;
852+
}
853+
854+
// A group of related accounts.
855+
message RelatedAccountGroup {
856+
option (google.api.resource) = {
857+
type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup"
858+
pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}"
859+
};
860+
861+
// Required. The resource name for the related account group in the format
862+
// `projects/{project}/relatedaccountgroups/{related_account_group}`.
863+
string name = 1 [
864+
(google.api.field_behavior) = REQUIRED,
865+
(google.api.resource_reference) = {
866+
type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup"
867+
}
868+
];
869+
}

0 commit comments

Comments
 (0)