REST Resource: projects.locations.authzPolicies

Resource: AuthzPolicy

AuthzPolicy is a resource that allows to forward traffic to a callout backend designed to scan the traffic for security purposes.

JSON representation
{
  "name": string,
  "createTime": string,
  "updateTime": string,
  "description": string,
  "labels": {
    string: string,
    ...
  },
  "target": {
    object (Target)
  },
  "httpRules": [
    {
      object (AuthzRule)
    }
  ],
  "action": enum (AuthzAction),
  "customProvider": {
    object (CustomProvider)
  }
}
Fields
name

string

Required. Identifier. Name of the AuthzPolicy resource in the following format: projects/{project}/locations/{location}/authzPolicies/{authzPolicy}.

createTime

string (Timestamp format)

Output only. The timestamp when the resource was created.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

updateTime

string (Timestamp format)

Output only. The timestamp when the resource was updated.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

description

string

Optional. A human-readable description of the resource.

labels

map (key: string, value: string)

Optional. Set of labels associated with the AuthzPolicy resource.

The format must comply with the following requirements.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

target

object (Target)

Required. Specifies the set of resources to which this policy should be applied to.

httpRules[]

object (AuthzRule)

Optional. A list of authorization HTTP rules to match against the incoming request. A policy match occurs when at least one HTTP rule matches the request or when no HTTP rules are specified in the policy. At least one HTTP Rule is required for Allow or Deny Action. Limited to 5 rules.

action

enum (AuthzAction)

Required. Can be one of ALLOW, DENY, CUSTOM.

When the action is CUSTOM, customProvider must be specified.

When the action is ALLOW, only requests matching the policy will be allowed.

When the action is DENY, only requests matching the policy will be denied.

When a request arrives, the policies are evaluated in the following order:

  1. If there is a CUSTOM policy that matches the request, the CUSTOM policy is evaluated using the custom authorization providers and the request is denied if the provider rejects the request.

  2. If there are any DENY policies that match the request, the request is denied.

  3. If there are no ALLOW policies for the resource or if any of the ALLOW policies match the request, the request is allowed.

  4. Else the request is denied by default if none of the configured AuthzPolicies with ALLOW action match the request.

customProvider

object (CustomProvider)

Optional. Required if the action is CUSTOM. Allows delegating authorization decisions to Cloud IAP or to Service Extensions. One of cloudIap or authzExtension must be specified.

Target

Specifies the set of targets to which this policy should be applied to.

JSON representation
{
  "loadBalancingScheme": enum (LoadBalancingScheme),
  "resources": [
    string
  ]
}
Fields
loadBalancingScheme

enum (LoadBalancingScheme)

Required. All gateways and forwarding rules referenced by this policy and extensions must share the same load balancing scheme. Supported values: INTERNAL_MANAGED and EXTERNAL_MANAGED. For more information, refer to Backend services overview.

resources[]

string

Required. A list of references to the Forwarding Rules on which this policy will be applied.

LoadBalancingScheme

Load balancing schemes supported by the AuthzPolicy resource. The valid values are INTERNAL_MANAGED and EXTERNAL_MANAGED. For more information, refer to Backend services overview.

Enums
LOAD_BALANCING_SCHEME_UNSPECIFIED Default value. Do not use.
INTERNAL_MANAGED Signifies that this is used for Regional internal or Cross-region internal Application Load Balancing.
EXTERNAL_MANAGED Signifies that this is used for Global external or Regional external Application Load Balancing.
INTERNAL_SELF_MANAGED Signifies that this is used for Cloud Service Mesh. Meant for use by CSM GKE controller only.

AuthzRule

Conditions to match against the incoming request.

JSON representation
{
  "from": {
    object (From)
  },
  "to": {
    object (To)
  },
  "when": string
}
Fields
from

object (From)

Optional. Describes properties of one or more sources of a request.

to

object (To)

Optional. Describes properties of one or more targets of a request.

when

string

Optional. CEL expression that describes the conditions to be satisfied for the action. The result of the CEL expression is ANDed with the from and to. Refer to the CEL language reference for a list of available attributes.

From

Describes properties of one or more sources of a request.

JSON representation
{
  "sources": [
    {
      object (RequestSource)
    }
  ],
  "notSources": [
    {
      object (RequestSource)
    }
  ]
}
Fields
sources[]

object (RequestSource)

Optional. Describes the properties of a request's sources. At least one of sources or notSources must be specified. Limited to 5 sources. A match occurs when ANY source (in sources or notSources) matches the request. Within a single source, the match follows AND semantics across fields and OR semantics within a single field, i.e. a match occurs when ANY principal matches AND ANY ipBlocks match.

notSources[]

object (RequestSource)

Optional. Describes the negated properties of request sources. Matches requests from sources that do not match the criteria specified in this field. At least one of sources or notSources must be specified.

RequestSource

Describes the properties of a single source.

JSON representation
{
  "principals": [
    {
      object (StringMatch)
    }
  ],
  "resources": [
    {
      object (RequestResource)
    }
  ]
}
Fields
principals[]

object (StringMatch)

Optional. A list of identities derived from the client's certificate. This field will not match on a request unless mutual TLS is enabled for the Forwarding rule or Gateway. Each identity is a string whose value is matched against the URI SAN, or DNS SAN or the subject field in the client's certificate. The match can be exact, prefix, suffix or a substring match. One of exact, prefix, suffix or contains must be specified. Limited to 5 principals.

resources[]

object (RequestResource)

Optional. A list of resources to match against the resource of the source VM of a request. Limited to 5 resources.

StringMatch

Determines how a string value should be matched.

JSON representation
{
  "ignoreCase": boolean,

  // Union field match_pattern can be only one of the following:
  "exact": string,
  "prefix": string,
  "suffix": string,
  "contains": string
  // End of list of possible types for union field match_pattern.
}
Fields
ignoreCase

boolean

If true, indicates the exact/prefix/suffix/contains matching should be case insensitive. For example, the matcher data will match both input string Data and data if set to true.

Union field match_pattern.

match_pattern can be only one of the following:

exact

string

The input string must match exactly the string specified here.

Examples:

  • abc only matches the value abc.
prefix

string

The input string must have the prefix specified here. Note: empty prefix is not allowed, please use regex instead.

Examples:

  • abc matches the value abc.xyz
suffix

string

The input string must have the suffix specified here. Note: empty prefix is not allowed, please use regex instead.

Examples:

  • abc matches the value xyz.abc
contains

string

The input string must have the substring specified here. Note: empty contains match is not allowed, please use regex instead.

Examples:

  • abc matches the value xyz.abc.def

RequestResource

Describes the properties of a client VM resource accessing the internal application load balancers.

JSON representation
{
  "tagValueIdSet": {
    object (TagValueIdSet)
  },
  "iamServiceAccount": {
    object (StringMatch)
  }
}
Fields
tagValueIdSet

object (TagValueIdSet)

Optional. A list of resource tag value permanent IDs to match against the resource manager tags value associated with the source VM of a request.

iamServiceAccount

object (StringMatch)

Optional. An IAM service account to match against the source service account of the VM sending the request.

TagValueIdSet

Describes a set of resource tag value permanent IDs to match against the resource manager tags value associated with the source VM of a request.

JSON representation
{
  "ids": [
    string
  ]
}
Fields
ids[]

string (int64 format)

Required. A list of resource tag value permanent IDs to match against the resource manager tags value associated with the source VM of a request. The match follows AND semantics which means all the ids must match. Limited to 5 matches.

To

Describes properties of one or more targets of a request.

JSON representation
{
  "operations": [
    {
      object (RequestOperation)
    }
  ],
  "notOperations": [
    {
      object (RequestOperation)
    }
  ]
}
Fields
operations[]

object (RequestOperation)

Optional. Describes properties of one or more targets of a request. At least one of operations or notOperations must be specified. Limited to 5 operations. A match occurs when ANY operation (in operations or notOperations) matches. Within an operation, the match follows AND semantics across fields and OR semantics within a field, i.e. a match occurs when ANY path matches AND ANY header matches and ANY method matches.

notOperations[]

object (RequestOperation)

Optional. Describes the negated properties of the targets of a request. Matches requests for operations that do not match the criteria specified in this field. At least one of operations or notOperations must be specified.

RequestOperation

Describes properties of one or more targets of a request.

JSON representation
{
  "headerSet": {
    object (HeaderSet)
  },
  "hosts": [
    {
      object (StringMatch)
    }
  ],
  "paths": [
    {
      object (StringMatch)
    }
  ],
  "methods": [
    string
  ]
}
Fields
headerSet

object (HeaderSet)

Optional. A list of headers to match against in http header.

hosts[]

object (StringMatch)

Optional. A list of HTTP Hosts to match against. The match can be one of exact, prefix, suffix, or contains (substring match). Matches are always case sensitive unless the ignoreCase is set. Limited to 5 matches.

paths[]

object (StringMatch)

Optional. A list of paths to match against. The match can be one of exact, prefix, suffix, or contains (substring match). Matches are always case sensitive unless the ignoreCase is set. Limited to 5 matches. Note that this path match includes the query parameters. For gRPC services, this should be a fully-qualified name of the form /package.service/method.

methods[]

string

Optional. A list of HTTP methods to match against. Each entry must be a valid HTTP method name (GET, PUT, POST, HEAD, PATCH, DELETE, OPTIONS). It only allows exact match and is always case sensitive.

HeaderSet

Describes a set of HTTP headers to match against.

JSON representation
{
  "headers": [
    {
      object (HeaderMatch)
    }
  ]
}
Fields
headers[]

object (HeaderMatch)

Required. A list of headers to match against in http header. The match can be one of exact, prefix, suffix, or contains (substring match). The match follows AND semantics which means all the headers must match. Matches are always case sensitive unless the ignoreCase is set. Limited to 5 matches.

HeaderMatch

Determines how a HTTP header should be matched.

JSON representation
{
  "name": string,
  "value": {
    object (StringMatch)
  }
}
Fields
name

string

Optional. Specifies the name of the header in the request.

value

object (StringMatch)

Optional. Specifies how the header match will be performed.

AuthzAction

The action to be applied to this policy. Valid values are ALLOW, DENY, CUSTOM.

Enums
AUTHZ_ACTION_UNSPECIFIED Unspecified action.
ALLOW Allow request to pass through to the backend.
DENY Deny the request and return a HTTP 404 to the client.
CUSTOM Delegate the authorization decision to an external authorization engine.

CustomProvider

Allows delegating authorization decisions to Cloud IAP or to Service Extensions.

JSON representation
{
  "cloudIap": {
    object (CloudIap)
  },
  "authzExtension": {
    object (AuthzExtension)
  }
}
Fields
cloudIap

object (CloudIap)

Optional. Delegates authorization decisions to Cloud IAP. Applicable only for managed load balancers. Enabling Cloud IAP at the AuthzPolicy level is not compatible with Cloud IAP settings in the BackendService. Enabling IAP in both places will result in request failure. Ensure that IAP is enabled in either the AuthzPolicy or the BackendService but not in both places.

authzExtension

object (AuthzExtension)

Optional. Delegate authorization decision to user authored Service Extension. Only one of cloudIap or authzExtension can be specified.

CloudIap

This type has no fields.

Optional. Delegates authorization decisions to Cloud IAP. Applicable only for managed load balancers. Enabling Cloud IAP at the AuthzPolicy level is not compatible with Cloud IAP settings in the BackendService. Enabling IAP in both places will result in request failure. Ensure that IAP is enabled in either the AuthzPolicy or the BackendService but not in both places.

AuthzExtension

Optional. Delegate authorization decision to user authored extension. Only one of cloudIap or authzExtension can be specified.

JSON representation
{
  "resources": [
    string
  ]
}
Fields
resources[]

string

Required. A list of references to authorization extensions that will be invoked for requests matching this policy. Limited to 1 custom provider.

Methods

create

Creates a new AuthzPolicy in a given project and location.

delete

Deletes a single AuthzPolicy.

get

Gets details of a single AuthzPolicy.

list

Lists AuthzPolicies in a given project and location.

patch

Updates the parameters of a single AuthzPolicy.