xref: /aosp_15_r20/external/googleapis/google/cloud/audit/audit_log.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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
15syntax = "proto3";
16
17package google.cloud.audit;
18
19import "google/api/field_behavior.proto";
20import "google/protobuf/any.proto";
21import "google/protobuf/struct.proto";
22import "google/rpc/context/attribute_context.proto";
23import "google/rpc/status.proto";
24
25option cc_enable_arenas = true;
26option go_package = "google.golang.org/genproto/googleapis/cloud/audit;audit";
27option java_multiple_files = true;
28option java_outer_classname = "AuditLogProto";
29option java_package = "com.google.cloud.audit";
30
31// Common audit log format for Google Cloud Platform API operations.
32message AuditLog {
33  // The name of the API service performing the operation. For example,
34  // `"compute.googleapis.com"`.
35  string service_name = 7;
36
37  // The name of the service method or operation.
38  // For API calls, this should be the name of the API method.
39  // For example,
40  //
41  //     "google.cloud.bigquery.v2.TableService.InsertTable"
42  //     "google.logging.v2.ConfigServiceV2.CreateSink"
43  string method_name = 8;
44
45  // The resource or collection that is the target of the operation.
46  // The name is a scheme-less URI, not including the API service name.
47  // For example:
48  //
49  //     "projects/PROJECT_ID/zones/us-central1-a/instances"
50  //     "projects/PROJECT_ID/datasets/DATASET_ID"
51  string resource_name = 11;
52
53  // The resource location information.
54  ResourceLocation resource_location = 20;
55
56  // The resource's original state before mutation. Present only for
57  // operations which have successfully modified the targeted resource(s).
58  // In general, this field should contain all changed fields, except those
59  // that are already been included in `request`, `response`, `metadata` or
60  // `service_data` fields.
61  // When the JSON object represented here has a proto equivalent,
62  // the proto name will be indicated in the `@type` property.
63  google.protobuf.Struct resource_original_state = 19;
64
65  // The number of items returned from a List or Query API method,
66  // if applicable.
67  int64 num_response_items = 12;
68
69  // The status of the overall operation.
70  google.rpc.Status status = 2;
71
72  // Authentication information.
73  AuthenticationInfo authentication_info = 3;
74
75  // Authorization information. If there are multiple
76  // resources or permissions involved, then there is
77  // one AuthorizationInfo element for each {resource, permission} tuple.
78  repeated AuthorizationInfo authorization_info = 9;
79
80  // Indicates the policy violations for this request. If the request
81  // is denied by the policy, violation information will be logged
82  // here.
83  PolicyViolationInfo policy_violation_info = 25;
84
85  // Metadata about the operation.
86  RequestMetadata request_metadata = 4;
87
88  // The operation request. This may not include all request parameters,
89  // such as those that are too large, privacy-sensitive, or duplicated
90  // elsewhere in the log record.
91  // It should never include user-generated data, such as file contents.
92  // When the JSON object represented here has a proto equivalent, the proto
93  // name will be indicated in the `@type` property.
94  google.protobuf.Struct request = 16;
95
96  // The operation response. This may not include all response elements,
97  // such as those that are too large, privacy-sensitive, or duplicated
98  // elsewhere in the log record.
99  // It should never include user-generated data, such as file contents.
100  // When the JSON object represented here has a proto equivalent, the proto
101  // name will be indicated in the `@type` property.
102  google.protobuf.Struct response = 17;
103
104  // Other service-specific data about the request, response, and other
105  // information associated with the current audited event.
106  google.protobuf.Struct metadata = 18;
107
108  // Deprecated. Use the `metadata` field instead.
109  // Other service-specific data about the request, response, and other
110  // activities.
111  google.protobuf.Any service_data = 15 [deprecated = true];
112}
113
114// Authentication information for the operation.
115message AuthenticationInfo {
116  // The email address of the authenticated user (or service account on behalf
117  // of third party principal) making the request. For third party identity
118  // callers, the `principal_subject` field is populated instead of this field.
119  // For privacy reasons, the principal email address is sometimes redacted.
120  // For more information, see [Caller identities in audit
121  // logs](https://cloud.google.com/logging/docs/audit#user-id).
122  string principal_email = 1;
123
124  // The authority selector specified by the requestor, if any.
125  // It is not guaranteed that the principal was allowed to use this authority.
126  string authority_selector = 2;
127
128  // The third party identification (if any) of the authenticated user making
129  // the request.
130  // When the JSON object represented here has a proto equivalent, the proto
131  // name will be indicated in the `@type` property.
132  google.protobuf.Struct third_party_principal = 4;
133
134  // The name of the service account key used to create or exchange
135  // credentials for authenticating the service account making the request.
136  // This is a scheme-less URI full resource name. For example:
137  //
138  // "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}"
139  string service_account_key_name = 5;
140
141  // Identity delegation history of an authenticated service account that makes
142  // the request. It contains information on the real authorities that try to
143  // access GCP resources by delegating on a service account. When multiple
144  // authorities present, they are guaranteed to be sorted based on the original
145  // ordering of the identity delegation events.
146  repeated ServiceAccountDelegationInfo service_account_delegation_info = 6;
147
148  // String representation of identity of requesting party.
149  // Populated for both first and third party identities.
150  string principal_subject = 8;
151}
152
153// Authorization information for the operation.
154message AuthorizationInfo {
155  // The resource being accessed, as a REST-style or cloud resource string.
156  // For example:
157  //
158  //     bigquery.googleapis.com/projects/PROJECTID/datasets/DATASETID
159  // or
160  //     projects/PROJECTID/datasets/DATASETID
161  string resource = 1;
162
163  // The required IAM permission.
164  string permission = 2;
165
166  // Whether or not authorization for `resource` and `permission`
167  // was granted.
168  bool granted = 3;
169
170  // Resource attributes used in IAM condition evaluation. This field contains
171  // resource attributes like resource type and resource name.
172  //
173  // To get the whole view of the attributes used in IAM
174  // condition evaluation, the user must also look into
175  // `AuditLog.request_metadata.request_attributes`.
176  google.rpc.context.AttributeContext.Resource resource_attributes = 5;
177}
178
179// Metadata about the request.
180message RequestMetadata {
181  // The IP address of the caller.
182  // For a caller from the internet, this will be the public IPv4 or IPv6
183  // address. For calls made from inside Google's internal production network
184  // from one GCP service to another, `caller_ip` will be redacted to "private".
185  // For a caller from a Compute Engine VM with a external IP address,
186  // `caller_ip` will be the VM's external IP address. For a caller from a
187  // Compute Engine VM without a external IP address, if the VM is in the same
188  // organization (or project) as the accessed resource, `caller_ip` will be the
189  // VM's internal IPv4 address, otherwise `caller_ip` will be redacted to
190  // "gce-internal-ip". See https://cloud.google.com/compute/docs/vpc/ for more
191  // information.
192  string caller_ip = 1;
193
194  // The user agent of the caller.
195  // This information is not authenticated and should be treated accordingly.
196  // For example:
197  //
198  // +   `google-api-python-client/1.4.0`:
199  //     The request was made by the Google API client for Python.
200  // +   `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`:
201  //     The request was made by the Google Cloud SDK CLI (gcloud).
202  // +   `AppEngine-Google; (+http://code.google.com/appengine; appid:
203  // s~my-project`:
204  //     The request was made from the `my-project` App Engine app.
205  string caller_supplied_user_agent = 2;
206
207  // The network of the caller.
208  // Set only if the network host project is part of the same GCP organization
209  // (or project) as the accessed resource.
210  // See https://cloud.google.com/compute/docs/vpc/ for more information.
211  // This is a scheme-less URI full resource name. For example:
212  //
213  //     "//compute.googleapis.com/projects/PROJECT_ID/global/networks/NETWORK_ID"
214  string caller_network = 3;
215
216  // Request attributes used in IAM condition evaluation. This field contains
217  // request attributes like request time and access levels associated with
218  // the request.
219  //
220  //
221  // To get the whole view of the attributes used in IAM
222  // condition evaluation, the user must also look into
223  // `AuditLog.authentication_info.resource_attributes`.
224  google.rpc.context.AttributeContext.Request request_attributes = 7;
225
226  // The destination of a network activity, such as accepting a TCP connection.
227  // In a multi hop network activity, the destination represents the receiver of
228  // the last hop. Only two fields are used in this message, Peer.port and
229  // Peer.ip. These fields are optionally populated by those services utilizing
230  // the IAM condition feature.
231  google.rpc.context.AttributeContext.Peer destination_attributes = 8;
232}
233
234// Location information about a resource.
235message ResourceLocation {
236  // The locations of a resource after the execution of the operation.
237  // Requests to create or delete a location based resource must populate
238  // the 'current_locations' field and not the 'original_locations' field.
239  // For example:
240  //
241  //     "europe-west1-a"
242  //     "us-east1"
243  //     "nam3"
244  repeated string current_locations = 1;
245
246  // The locations of a resource prior to the execution of the operation.
247  // Requests that mutate the resource's location must populate both the
248  // 'original_locations' as well as the 'current_locations' fields.
249  // For example:
250  //
251  //     "europe-west1-a"
252  //     "us-east1"
253  //     "nam3"
254  repeated string original_locations = 2;
255}
256
257// Identity delegation history of an authenticated service account.
258message ServiceAccountDelegationInfo {
259  // First party identity principal.
260  message FirstPartyPrincipal {
261    // The email address of a Google account.
262    string principal_email = 1;
263
264    // Metadata about the service that uses the service account.
265    google.protobuf.Struct service_metadata = 2;
266  }
267
268  // Third party identity principal.
269  message ThirdPartyPrincipal {
270    // Metadata about third party identity.
271    google.protobuf.Struct third_party_claims = 1;
272  }
273
274  // A string representing the principal_subject associated with the identity.
275  // For most identities, the format will be
276  // `principal://iam.googleapis.com/{identity pool name}/subject/{subject)`
277  // except for some GKE identities (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD)
278  // that are still in the legacy format `serviceAccount:{identity pool
279  // name}[{subject}]`
280  string principal_subject = 3;
281
282  // Entity that creates credentials for service account and assumes its
283  // identity for authentication.
284  oneof Authority {
285    // First party (Google) identity as the real authority.
286    FirstPartyPrincipal first_party_principal = 1;
287
288    // Third party identity as the real authority.
289    ThirdPartyPrincipal third_party_principal = 2;
290  }
291}
292
293// Information related to policy violations for this request.
294message PolicyViolationInfo {
295  // Indicates the orgpolicy violations for this resource.
296  OrgPolicyViolationInfo org_policy_violation_info = 1;
297}
298
299// Represents OrgPolicy Violation information.
300message OrgPolicyViolationInfo {
301  // Optional. Resource payload that is currently in scope and is subjected to orgpolicy
302  // conditions. This payload may be the subset of the actual Resource that may
303  // come in the request. This payload should not contain any core content.
304  google.protobuf.Struct payload = 1 [(google.api.field_behavior) = OPTIONAL];
305
306  // Optional. Resource type that the orgpolicy is checked against.
307  // Example: compute.googleapis.com/Instance, store.googleapis.com/bucket
308  string resource_type = 2 [(google.api.field_behavior) = OPTIONAL];
309
310  // Optional. Tags referenced on the resource at the time of evaluation. These also
311  // include the federated tags, if they are supplied in the CheckOrgPolicy
312  // or CheckCustomConstraints Requests.
313  //
314  // Optional field as of now. These tags are the Cloud tags that are
315  // available on the resource during the policy evaluation and will
316  // be available as part of the OrgPolicy check response for logging purposes.
317  map<string, string> resource_tags = 3 [(google.api.field_behavior) = OPTIONAL];
318
319  // Optional. Policy violations
320  repeated ViolationInfo violation_info = 4 [(google.api.field_behavior) = OPTIONAL];
321}
322
323// Provides information about the Policy violation info for this request.
324message ViolationInfo {
325  // Policy Type enum
326  enum PolicyType {
327    // Default value. This value should not be used.
328    POLICY_TYPE_UNSPECIFIED = 0;
329
330    // Indicates boolean policy constraint
331    BOOLEAN_CONSTRAINT = 1;
332
333    // Indicates list policy constraint
334    LIST_CONSTRAINT = 2;
335
336    // Indicates custom policy constraint
337    CUSTOM_CONSTRAINT = 3;
338  }
339
340  // Optional. Constraint name
341  string constraint = 1 [(google.api.field_behavior) = OPTIONAL];
342
343  // Optional. Error message that policy is indicating.
344  string error_message = 2 [(google.api.field_behavior) = OPTIONAL];
345
346  // Optional. Value that is being checked for the policy.
347  // This could be in encrypted form (if pii sensitive).
348  // This field will only be emitted in LIST_POLICY types
349  string checked_value = 3 [(google.api.field_behavior) = OPTIONAL];
350
351  // Optional. Indicates the type of the policy.
352  PolicyType policy_type = 4 [(google.api.field_behavior) = OPTIONAL];
353}