Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

feat: Add SOCIAL_ENGINEERING_EXTENDED_COVERAGE threat type #238

Merged
merged 2 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions google/cloud/webrisk_v1/services/web_risk_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ async def sample_compute_threat_list_diff():

# Initialize request argument(s)
request = webrisk_v1.ComputeThreatListDiffRequest(
threat_type="UNWANTED_SOFTWARE",
threat_type="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand All @@ -256,7 +256,9 @@ async def sample_compute_threat_list_diff():
threat_type (:class:`google.cloud.webrisk_v1.types.ThreatType`):
Required. The threat list to update.
Only a single ThreatType should be
specified.
specified per request. If you want to
handle multiple ThreatTypes, you must
make one request per ThreatType.

This corresponds to the ``threat_type`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -377,7 +379,7 @@ async def sample_search_uris():
# Initialize request argument(s)
request = webrisk_v1.SearchUrisRequest(
uri="uri_value",
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down Expand Up @@ -497,7 +499,7 @@ async def sample_search_hashes():

# Initialize request argument(s)
request = webrisk_v1.SearchHashesRequest(
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand All @@ -514,7 +516,10 @@ async def sample_search_hashes():
A hash prefix, consisting of the most
significant 4-32 bytes of a SHA256 hash.
For JSON requests, this field is
base64-encoded.
base64-encoded. Note that if this
parameter is provided by a URI, it must
be encoded using the web safe base64
variant (RFC 4648).

This corresponds to the ``hash_prefix`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -601,8 +606,9 @@ async def create_submission(
`Google's Social Engineering
lists <https://support.google.com/webmasters/answer/6350487/>`__
in order to protect users that could get exposed to this threat
in the future. Only projects with CREATE_SUBMISSION_USERS
visibility can use this method.
in the future. Only allowlisted projects can use this method
during Early Access. Please reach out to Sales or your customer
engineer to obtain access.

.. code-block:: python

Expand Down Expand Up @@ -663,7 +669,7 @@ async def sample_create_submission():
Returns:
google.cloud.webrisk_v1.types.Submission:
Wraps a URI that might be displaying
phishing content.
malicious content.

"""
# Create or coerce a protobuf request object.
Expand All @@ -689,7 +695,7 @@ async def sample_create_submission():
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_submission,
default_timeout=60.0,
default_timeout=600.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down
22 changes: 14 additions & 8 deletions google/cloud/webrisk_v1/services/web_risk_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def sample_compute_threat_list_diff():

# Initialize request argument(s)
request = webrisk_v1.ComputeThreatListDiffRequest(
threat_type="UNWANTED_SOFTWARE",
threat_type="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand All @@ -461,7 +461,9 @@ def sample_compute_threat_list_diff():
threat_type (google.cloud.webrisk_v1.types.ThreatType):
Required. The threat list to update.
Only a single ThreatType should be
specified.
specified per request. If you want to
handle multiple ThreatTypes, you must
make one request per ThreatType.

This corresponds to the ``threat_type`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -572,7 +574,7 @@ def sample_search_uris():
# Initialize request argument(s)
request = webrisk_v1.SearchUrisRequest(
uri="uri_value",
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down Expand Up @@ -682,7 +684,7 @@ def sample_search_hashes():

# Initialize request argument(s)
request = webrisk_v1.SearchHashesRequest(
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand All @@ -699,7 +701,10 @@ def sample_search_hashes():
A hash prefix, consisting of the most
significant 4-32 bytes of a SHA256 hash.
For JSON requests, this field is
base64-encoded.
base64-encoded. Note that if this
parameter is provided by a URI, it must
be encoded using the web safe base64
variant (RFC 4648).

This corresponds to the ``hash_prefix`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -776,8 +781,9 @@ def create_submission(
`Google's Social Engineering
lists <https://support.google.com/webmasters/answer/6350487/>`__
in order to protect users that could get exposed to this threat
in the future. Only projects with CREATE_SUBMISSION_USERS
visibility can use this method.
in the future. Only allowlisted projects can use this method
during Early Access. Please reach out to Sales or your customer
engineer to obtain access.

.. code-block:: python

Expand Down Expand Up @@ -838,7 +844,7 @@ def sample_create_submission():
Returns:
google.cloud.webrisk_v1.types.Submission:
Wraps a URI that might be displaying
phishing content.
malicious content.

"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _prep_wrapped_messages(self, client_info):
),
self.create_submission: gapic_v1.method.wrap_method(
self.create_submission,
default_timeout=60.0,
default_timeout=600.0,
client_info=client_info,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ def create_submission(
`Google's Social Engineering
lists <https://support.google.com/webmasters/answer/6350487/>`__
in order to protect users that could get exposed to this threat
in the future. Only projects with CREATE_SUBMISSION_USERS
visibility can use this method.
in the future. Only allowlisted projects can use this method
during Early Access. Please reach out to Sales or your customer
engineer to obtain access.

Returns:
Callable[[~.CreateSubmissionRequest],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ def create_submission(
`Google's Social Engineering
lists <https://support.google.com/webmasters/answer/6350487/>`__
in order to protect users that could get exposed to this threat
in the future. Only projects with CREATE_SUBMISSION_USERS
visibility can use this method.
in the future. Only allowlisted projects can use this method
during Early Access. Please reach out to Sales or your customer
engineer to obtain access.

Returns:
Callable[[~.CreateSubmissionRequest],
Expand Down
19 changes: 13 additions & 6 deletions google/cloud/webrisk_v1/types/webrisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@


class ThreatType(proto.Enum):
r"""The type of threat. This maps dirrectly to the threat list a
r"""The type of threat. This maps directly to the threat list a
threat may belong to.
"""
THREAT_TYPE_UNSPECIFIED = 0
MALWARE = 1
SOCIAL_ENGINEERING = 2
UNWANTED_SOFTWARE = 3
SOCIAL_ENGINEERING_EXTENDED_COVERAGE = 4


class CompressionType(proto.Enum):
Expand All @@ -61,7 +62,10 @@ class ComputeThreatListDiffRequest(proto.Message):
Attributes:
threat_type (google.cloud.webrisk_v1.types.ThreatType):
Required. The threat list to update. Only a
single ThreatType should be specified.
single ThreatType should be specified per
request. If you want to handle multiple
ThreatTypes, you must make one request per
ThreatType.
version_token (bytes):
The current version token of the client for
the requested list (the client version that was
Expand Down Expand Up @@ -238,8 +242,8 @@ class SearchUrisResponse(proto.Message):

Attributes:
threat (google.cloud.webrisk_v1.types.SearchUrisResponse.ThreatUri):
The threat list matches. This may be empty if
the URI is on no list.
The threat list matches. This might be empty
if the URI is on no list.
"""

class ThreatUri(proto.Message):
Expand Down Expand Up @@ -281,6 +285,9 @@ class SearchHashesRequest(proto.Message):
A hash prefix, consisting of the most
significant 4-32 bytes of a SHA256 hash. For
JSON requests, this field is base64-encoded.
Note that if this parameter is provided by a
URI, it must be encoded using the web safe
base64 variant (RFC 4648).
threat_types (Sequence[google.cloud.webrisk_v1.types.ThreatType]):
Required. The ThreatLists to search in.
Multiple ThreatLists may be specified.
Expand Down Expand Up @@ -500,12 +507,12 @@ class RiceDeltaEncoding(proto.Message):


class Submission(proto.Message):
r"""Wraps a URI that might be displaying phishing content.
r"""Wraps a URI that might be displaying malicious content.

Attributes:
uri (str):
Required. The URI that is being reported for
phishing content to be analyzed.
malicious content to be analyzed.
"""

uri = proto.Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def sample_compute_threat_list_diff():

# Initialize request argument(s)
request = webrisk_v1.ComputeThreatListDiffRequest(
threat_type="UNWANTED_SOFTWARE",
threat_type="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def sample_compute_threat_list_diff():

# Initialize request argument(s)
request = webrisk_v1.ComputeThreatListDiffRequest(
threat_type="UNWANTED_SOFTWARE",
threat_type="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def sample_search_hashes():

# Initialize request argument(s)
request = webrisk_v1.SearchHashesRequest(
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def sample_search_hashes():

# Initialize request argument(s)
request = webrisk_v1.SearchHashesRequest(
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def sample_search_uris():
# Initialize request argument(s)
request = webrisk_v1.SearchUrisRequest(
uri="uri_value",
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def sample_search_uris():
# Initialize request argument(s)
request = webrisk_v1.SearchUrisRequest(
uri="uri_value",
threat_types="UNWANTED_SOFTWARE",
threat_types="SOCIAL_ENGINEERING_EXTENDED_COVERAGE",
)

# Make the request
Expand Down