Service Client: Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SafeBrowsingClient

Client stub representing the remote SafeBrowsing gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to security.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Security::Safebrowsing::V5alpha1::Safebrowsing - Compiled Protocol Buffers messages for google/security/safebrowsing/v5alpha1/safebrowsing.proto

SYNOPSIS

use Google::Security::Safebrowsing::V5alpha1::Safebrowsing;

my $msg = Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SearchHashesRequest->new({
    hash_prefixes => $hash_prefixes,
    filter => $filter,
});

# Read or update a field
my $val = $msg->hash_prefixes();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SearchHashesRequest->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/security/safebrowsing/v5alpha1/safebrowsing.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SearchHashesRequest

A request that the client issues to search for specific hash prefixes.

This is designed to only searches threat lists, and does not search non-threat lists such as the Global Cache.

What's new in V5: Clients don't need to specify a `ClientInfo` or the states of the hash lists in their local database. This is for improved privacy. Furthermore, clients don't need to send which threat types they are interested in.

Inherits from Protobuf::Message.

Accessors

  • $msg->hash_prefixes() / $msg->hash_prefixes($value)

    Type: Bytes

    Required. The hash prefixes to be looked up. Clients MUST NOT send more than 1000 hash prefixes. However, following the URL processing procedure, clients SHOULD NOT need to send more than 30 hash prefixes.

    Currently each hash prefix is required to be exactly 4 bytes long. This MAY be relaxed in the future.

  • $msg->filter() / $msg->filter($value)

    Type: String

    Optional. If the client is interested in filtering, such as only retrieving specific kinds of threats, this can be specified. If omitted, all matching threats are returned. It is highly recommended to omit this to get the most complete protection Safe Browsing can offer.

    The filter is specified using Google Common Expression Language, which can be found at https://github.com/google/cel-spec along with general examples. Here are some specific examples that can be used here:

    The filter `"threat_type == ThreatType.SOCIAL_ENGINEERING"` requires that the within `FullHashDetail` the threat type must be `SOCIAL_ENGINEERING`. The identifier `"threat_type"` refers to the current threat type. The identifier `"ThreatType"` refers to the collection of all possible threat types.

    The filter `"threat_type in [ ThreatType.UNWANTED_SOFTWARE, ThreatType.MALWARE ]"` requires that the threat type must be either `UNWANTED_SOFTWARE` or `MALWARE`.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SearchHashesResponse

The response returned after searching threat hashes.

If nothing is found, the server will return an OK status (HTTP status code 200) with the `full_hashes` field empty, rather than returning a NOT_FOUND status (HTTP status code 404).

What's new in V5: There is a separation between `FullHash` and `FullHashDetail`. In the case when a hash represents a site having multiple threats (e.g. both MALWARE and SOCIAL_ENGINEERING), the full hash does not need to be sent twice as in V4. Furthermore, the cache duration has been simplified into a single `cache_duration` field.

Inherits from Protobuf::Message.

Accessors

  • $msg->full_hashes() / $msg->full_hashes($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::FullHash)

    Unordered list. The unordered list of full hashes found.

  • $msg->cache_duration() / $msg->cache_duration($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    The client-side cache duration. The client MUST add this duration to the current time to determine the expiration time. The expiration time then applies to every hash prefix queried by the client in the request, regardless of how many full hashes are returned in the response. Even if the server returns no full hashes for a particular hash prefix, this fact MUST also be cached by the client.

    If and only if the field `full_hashes` is empty, the client MAY increase the `cache_duration` to determine a new expiration that is later than that specified by the server. In any case, the increased cache duration must not be longer than 24 hours.

    Important: the client MUST NOT assume that the server will return the same cache duration for all responses. The server MAY choose different cache durations for different responses depending on the situation.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::FullHash

The full hash identified with one or more matches.

Inherits from Protobuf::Message.

Accessors

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::GetHashListRequest

A request to obtain a hash list, which may be a threat list or a non-threat list such as the Global Cache.

What's new in V5: What was previously called `states` in V4 is renamed to `version` for clarity. Lists are now named, platform types and threat entry types are removed. It is now possible for multiple lists to have the same threat type, or a single list concerned with multiple threat types. In contrast to V4's variable-length hash prefixes which has caused trouble in many client implementations: all hashes in a list now have a single length, permitting much more efficient client implementations. Constraints have been simplified, and compression type is removed (compression is always applied).

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    Required. The name of this particular hash list. It may be a threat list, or it may be the Global Cache.

  • $msg->version() / $msg->version($value)

    Type: Bytes

    The version of the hash list that the client already has. If this is the first time the client is fetching the hash list, this field MUST be left empty. Otherwise, the client SHOULD supply the version previously received from the server. The client MUST NOT manipulate those bytes.

    What's new in V5: in V4 of the API, this was called `states`; it is now renamed to `version` for clarity.

  • $msg->size_constraints() / $msg->size_constraints($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SizeConstraints)

    The size constraints on the list. If omitted, there are no constraints. Constraints are recommended on all devices with limited processing power, bandwidth, or storage.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SizeConstraints

The constraints on the sizes of the hash lists.

Inherits from Protobuf::Message.

Accessors

  • $msg->max_update_entries() / $msg->max_update_entries($value)

    Type: Int32

    The maximum size in number of entries. The update will not contain more entries than this value, but it is possible that the update will contain fewer entries than this value. This MUST be at least 1024. If omitted or zero, no update size limit is set.

  • $msg->max_database_entries() / $msg->max_database_entries($value)

    Type: Int32

    Sets the maximum number of entries that the client is willing to have in the local database for the list. (The server MAY cause the client to store less than this number of entries.) If omitted or zero, no database size limit is set.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded32Bit

The Rice-Golomb encoded data. Used for either hashes or removal indices. It is guaranteed that every hash or index here has the same length, and this length is exactly 32 bits.

Generally speaking, if we sort all the entries lexicographically, we will find that the higher order bits tend not to change as frequently as lower order bits. This means that if we also take the adjacent difference between entries, the higher order bits have a high probability of being zero. This exploits this high probability of zero by essentially choosing a certain number of bits; all bits more significant than this are likely to be zero so we use unary encoding. See the `rice_parameter` field.

Historical note: the Rice-delta encoding was first used in V4 of this API. In V5, two significant improvements were made: firstly, the Rice-delta encoding is now available with hash prefixes longer than 4 bytes; secondly, the encoded data are now treated as big-endian so as to avoid a costly sorting step.

Inherits from Protobuf::Message.

Accessors

  • $msg->first_value() / $msg->first_value($value)

    Type: UInt32

    The first entry in the encoded data (hashes or indices), or, if only a single hash prefix or index was encoded, that entry's value. If the field is empty, the entry is zero.

  • $msg->rice_parameter() / $msg->rice_parameter($value)

    Type: Int32

    The Golomb-Rice parameter. This parameter is guaranteed to be between 3 and 30, inclusive.

  • $msg->entries_count() / $msg->entries_count($value)

    Type: Int32

    The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in `first_value`.

  • $msg->encoded_data() / $msg->encoded_data($value)

    Type: Bytes

    The encoded deltas that are encoded using the Golomb-Rice coder.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded64Bit

Same as `RiceDeltaEncoded32Bit` except this encodes 64-bit numbers.

Inherits from Protobuf::Message.

Accessors

  • $msg->first_value() / $msg->first_value($value)

    Type: UInt64

    The first entry in the encoded data (hashes), or, if only a single hash prefix was encoded, that entry's value. If the field is empty, the entry is zero.

  • $msg->rice_parameter() / $msg->rice_parameter($value)

    Type: Int32

    The Golomb-Rice parameter. This parameter is guaranteed to be between 35 and 62, inclusive.

  • $msg->entries_count() / $msg->entries_count($value)

    Type: Int32

    The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in `first_value`.

  • $msg->encoded_data() / $msg->encoded_data($value)

    Type: Bytes

    The encoded deltas that are encoded using the Golomb-Rice coder.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded128Bit

Same as `RiceDeltaEncoded32Bit` except this encodes 128-bit numbers.

Inherits from Protobuf::Message.

Accessors

  • $msg->first_value_hi() / $msg->first_value_hi($value)

    Type: UInt64

    The upper 64 bits of the first entry in the encoded data (hashes). If the field is empty, the upper 64 bits are all zero.

  • $msg->first_value_lo() / $msg->first_value_lo($value)

    Type: Fixed64

    The lower 64 bits of the first entry in the encoded data (hashes). If the field is empty, the lower 64 bits are all zero.

  • $msg->rice_parameter() / $msg->rice_parameter($value)

    Type: Int32

    The Golomb-Rice parameter. This parameter is guaranteed to be between 99 and 126, inclusive.

  • $msg->entries_count() / $msg->entries_count($value)

    Type: Int32

    The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in `first_value`.

  • $msg->encoded_data() / $msg->encoded_data($value)

    Type: Bytes

    The encoded deltas that are encoded using the Golomb-Rice coder.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded256Bit

Same as `RiceDeltaEncoded32Bit` except this encodes 256-bit numbers.

Inherits from Protobuf::Message.

Accessors

  • $msg->first_value_first_part() / $msg->first_value_first_part($value)

    Type: UInt64

    The first 64 bits of the first entry in the encoded data (hashes). If the field is empty, the first 64 bits are all zero.

  • $msg->first_value_second_part() / $msg->first_value_second_part($value)

    Type: Fixed64

    The 65 through 128th bits of the first entry in the encoded data (hashes). If the field is empty, the 65 through 128th bits are all zero.

  • $msg->first_value_third_part() / $msg->first_value_third_part($value)

    Type: Fixed64

    The 129 through 192th bits of the first entry in the encoded data (hashes). If the field is empty, the 129 through 192th bits are all zero.

  • $msg->first_value_fourth_part() / $msg->first_value_fourth_part($value)

    Type: Fixed64

    The last 64 bits of the first entry in the encoded data (hashes). If the field is empty, the last 64 bits are all zero.

  • $msg->rice_parameter() / $msg->rice_parameter($value)

    Type: Int32

    The Golomb-Rice parameter. This parameter is guaranteed to be between 227 and 254, inclusive.

  • $msg->entries_count() / $msg->entries_count($value)

    Type: Int32

    The number of entries that are delta encoded in the encoded data. If only a single integer was encoded, this will be zero and the single value will be stored in `first_value`.

  • $msg->encoded_data() / $msg->encoded_data($value)

    Type: Bytes

    The encoded deltas that are encoded using the Golomb-Rice coder.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::HashListMetadata

Metadata about a particular hash list.

Inherits from Protobuf::Message.

Accessors

  • $msg->threat_types() / $msg->threat_types($value)

    Type: Enum (Google::Security::Safebrowsing::V5alpha1::ThreatType)

    Unordered list. If not empty, this specifies that the hash list is a kind of threat list, and this enumerates the kind of threats associated with hashes or hash prefixes in this hash list. May be empty if the entry does not represent a threat, i.e. in the case that it represents a likely safe type.

  • $msg->likely_safe_types() / $msg->likely_safe_types($value)

    Type: Enum (Google::Security::Safebrowsing::V5alpha1::LikelySafeType)

    Unordered list. If not empty, this specifies that the hash list represents a list of likely safe hashes, and this enumerates the ways they are considered likely safe. This field is mutually exclusive with the threat_types field.

  • $msg->description() / $msg->description($value)

    Type: String

    A human-readable description about this list. Written in English.

  • $msg->hash_length() / $msg->hash_length($value)

    Type: Enum (Google::Security::Safebrowsing::V5alpha1::HashListMetadata::HashLength)

    The supported hash length for this hash list. Each hash list will support exactly one length. If a different hash length is introduced for the same set of threat types or safe types, it will be introduced as a separate list with a distinct name and respective hash length set.

Enum: HashListMetadata::HashLength

  • HASH_LENGTH_UNSPECIFIED => 0

  • FOUR_BYTES => 2

  • EIGHT_BYTES => 3

  • SIXTEEN_BYTES => 4

  • THIRTY_TWO_BYTES => 5

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::HashList

A list of hashes identified by its name.

Inherits from Protobuf::Message.

Accessors

  • $msg->additions_four_bytes() / $msg->additions_four_bytes($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded32Bit)

    The 4-byte additions.

  • $msg->additions_eight_bytes() / $msg->additions_eight_bytes($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded64Bit)

    The 8-byte additions.

  • $msg->additions_sixteen_bytes() / $msg->additions_sixteen_bytes($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded128Bit)

    The 16-byte additions.

  • $msg->additions_thirty_two_bytes() / $msg->additions_thirty_two_bytes($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded256Bit)

    The 32-byte additions.

  • $msg->name() / $msg->name($value)

    Type: String

    The name of the hash list. Note that the Global Cache is also just a hash list and can be referred to here.

  • $msg->version() / $msg->version($value)

    Type: Bytes

    The version of the hash list. The client MUST NOT manipulate those bytes.

  • $msg->partial_update() / $msg->partial_update($value)

    Type: Bool

    When true, this is a partial diff containing additions and removals based on what the client already has. When false, this is the complete hash list.

    When false, the client MUST delete any locally stored version for this hash list. This means that either the version possessed by the client is seriously out-of-date or the client data is believed to be corrupt. The `compressed_removals` field will be empty.

    When true, the client MUST apply an incremental update by applying removals and then additions.

  • $msg->compressed_removals() / $msg->compressed_removals($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::RiceDeltaEncoded32Bit)

    The Rice-delta encoded version of removal indices. Since each hash list definitely has less than 2^32 entries, the indices are treated as 32-bit integers and encoded.

  • $msg->minimum_wait_duration() / $msg->minimum_wait_duration($value)

    Type: Message (Google::Protobuf::Duration::Duration)

    Clients should wait at least this long to get the hash list again. If omitted or zero, clients SHOULD fetch immediately because it indicates that the server has an additional update to be sent to the client, but could not due to the client-specified constraints.

  • $msg->sha256_checksum() / $msg->sha256_checksum($value)

    Type: Bytes

    The sorted list of all hashes, hashed again with SHA256. This is the checksum for the sorted list of all hashes present in the database after applying the provided update. In the case that no updates were provided, the server will omit this field to indicate that the client should use the existing checksum.

  • $msg->metadata() / $msg->metadata($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::HashListMetadata)

    Metadata about the hash list. This is not populated by the `GetHashList` method, but this is populated by the `ListHashLists` method.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::BatchGetHashListsRequest

The request to get multiple hash lists at the same time.

Inherits from Protobuf::Message.

Accessors

  • $msg->names() / $msg->names($value)

    Type: String

    Required. The names of the particular hash lists. The list MAY be a threat list, or it may be the Global Cache. The names MUST NOT contain duplicates; if they did, the client will get an error.

  • $msg->version() / $msg->version($value)

    Type: Bytes

    The versions of the hash list that the client already has. If this is the first time the client is fetching the hash lists, the field should be left empty. Otherwise, the client should supply the versions previously received from the server. The client MUST NOT manipulate those bytes.

    The client need not send the versions in the same order as the corresponding list names. The client may send fewer or more versions in a request than there are names. However the client MUST NOT send multiple versions that correspond to the same name; if it did, the client will get an error.

    Historical note: in V4 of the API, this was called `states`; it is now renamed to `version` for clarity.

  • $msg->size_constraints() / $msg->size_constraints($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::SizeConstraints)

    The size constraints on each list. If omitted, there are no constraints. Note that the sizes here are per-list, not aggregated across all lists.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::BatchGetHashListsResponse

The response containing multiple hash lists.

Inherits from Protobuf::Message.

Accessors

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::ListHashListsRequest

The request to list the available hash lists.

Inherits from Protobuf::Message.

Accessors

  • $msg->page_size() / $msg->page_size($value)

    Type: Int32

    The maximum number of hash lists to return. The service may return fewer than this value. If unspecified, the server will choose a page size, which may be larger than the number of hash lists so that pagination is not necessary.

  • $msg->page_token() / $msg->page_token($value)

    Type: String

    A page token, received from a previous `ListHashLists` call. Provide this to retrieve the subsequent page.

Google::Security::Safebrowsing::V5alpha1::Safebrowsing::ListHashListsResponse

The response containing metadata about hash lists.

Inherits from Protobuf::Message.

Accessors

  • $msg->hash_lists() / $msg->hash_lists($value)

    Type: Message (Google::Security::Safebrowsing::V5alpha1::Safebrowsing::HashList)

    The hash lists in an arbitrary order. Only metadata about the hash lists will be included, not the contents.

  • $msg->next_page_token() / $msg->next_page_token($value)

    Type: String

    A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.

SEE ALSO

Protobuf, Protobuf::Message, Google::Security::Safebrowsing::V5alpha1::Safebrowsing::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.