audit_log.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.cloud.audit;
  16. import "google/protobuf/any.proto";
  17. import "google/protobuf/struct.proto";
  18. import "google/rpc/context/attribute_context.proto";
  19. import "google/rpc/status.proto";
  20. option cc_enable_arenas = true;
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/audit;audit";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "AuditLogProto";
  24. option java_package = "com.google.cloud.audit";
  25. // Common audit log format for Google Cloud Platform API operations.
  26. message AuditLog {
  27. // The name of the API service performing the operation. For example,
  28. // `"compute.googleapis.com"`.
  29. string service_name = 7;
  30. // The name of the service method or operation.
  31. // For API calls, this should be the name of the API method.
  32. // For example,
  33. //
  34. // "google.cloud.bigquery.v2.TableService.InsertTable"
  35. // "google.logging.v2.ConfigServiceV2.CreateSink"
  36. string method_name = 8;
  37. // The resource or collection that is the target of the operation.
  38. // The name is a scheme-less URI, not including the API service name.
  39. // For example:
  40. //
  41. // "projects/PROJECT_ID/zones/us-central1-a/instances"
  42. // "projects/PROJECT_ID/datasets/DATASET_ID"
  43. string resource_name = 11;
  44. // The resource location information.
  45. ResourceLocation resource_location = 20;
  46. // The resource's original state before mutation. Present only for
  47. // operations which have successfully modified the targeted resource(s).
  48. // In general, this field should contain all changed fields, except those
  49. // that are already been included in `request`, `response`, `metadata` or
  50. // `service_data` fields.
  51. // When the JSON object represented here has a proto equivalent,
  52. // the proto name will be indicated in the `@type` property.
  53. google.protobuf.Struct resource_original_state = 19;
  54. // The number of items returned from a List or Query API method,
  55. // if applicable.
  56. int64 num_response_items = 12;
  57. // The status of the overall operation.
  58. google.rpc.Status status = 2;
  59. // Authentication information.
  60. AuthenticationInfo authentication_info = 3;
  61. // Authorization information. If there are multiple
  62. // resources or permissions involved, then there is
  63. // one AuthorizationInfo element for each {resource, permission} tuple.
  64. repeated AuthorizationInfo authorization_info = 9;
  65. // Metadata about the operation.
  66. RequestMetadata request_metadata = 4;
  67. // The operation request. This may not include all request parameters,
  68. // such as those that are too large, privacy-sensitive, or duplicated
  69. // elsewhere in the log record.
  70. // It should never include user-generated data, such as file contents.
  71. // When the JSON object represented here has a proto equivalent, the proto
  72. // name will be indicated in the `@type` property.
  73. google.protobuf.Struct request = 16;
  74. // The operation response. This may not include all response elements,
  75. // such as those that are too large, privacy-sensitive, or duplicated
  76. // elsewhere in the log record.
  77. // It should never include user-generated data, such as file contents.
  78. // When the JSON object represented here has a proto equivalent, the proto
  79. // name will be indicated in the `@type` property.
  80. google.protobuf.Struct response = 17;
  81. // Other service-specific data about the request, response, and other
  82. // information associated with the current audited event.
  83. google.protobuf.Struct metadata = 18;
  84. // Deprecated. Use the `metadata` field instead.
  85. // Other service-specific data about the request, response, and other
  86. // activities.
  87. google.protobuf.Any service_data = 15 [deprecated = true];
  88. }
  89. // Authentication information for the operation.
  90. message AuthenticationInfo {
  91. // The email address of the authenticated user (or service account on behalf
  92. // of third party principal) making the request. For third party identity
  93. // callers, the `principal_subject` field is populated instead of this field.
  94. // For privacy reasons, the principal email address is sometimes redacted.
  95. // For more information, see
  96. // https://cloud.google.com/logging/docs/audit#user-id.
  97. string principal_email = 1;
  98. // The authority selector specified by the requestor, if any.
  99. // It is not guaranteed that the principal was allowed to use this authority.
  100. string authority_selector = 2;
  101. // The third party identification (if any) of the authenticated user making
  102. // the request.
  103. // When the JSON object represented here has a proto equivalent, the proto
  104. // name will be indicated in the `@type` property.
  105. google.protobuf.Struct third_party_principal = 4;
  106. // The name of the service account key used to create or exchange
  107. // credentials for authenticating the service account making the request.
  108. // This is a scheme-less URI full resource name. For example:
  109. //
  110. // "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}"
  111. string service_account_key_name = 5;
  112. // Identity delegation history of an authenticated service account that makes
  113. // the request. It contains information on the real authorities that try to
  114. // access GCP resources by delegating on a service account. When multiple
  115. // authorities present, they are guaranteed to be sorted based on the original
  116. // ordering of the identity delegation events.
  117. repeated ServiceAccountDelegationInfo service_account_delegation_info = 6;
  118. // String representation of identity of requesting party.
  119. // Populated for both first and third party identities.
  120. string principal_subject = 8;
  121. }
  122. // Authorization information for the operation.
  123. message AuthorizationInfo {
  124. // The resource being accessed, as a REST-style or cloud resource string.
  125. // For example:
  126. //
  127. // bigquery.googleapis.com/projects/PROJECTID/datasets/DATASETID
  128. // or
  129. // projects/PROJECTID/datasets/DATASETID
  130. string resource = 1;
  131. // The required IAM permission.
  132. string permission = 2;
  133. // Whether or not authorization for `resource` and `permission`
  134. // was granted.
  135. bool granted = 3;
  136. // Resource attributes used in IAM condition evaluation. This field contains
  137. // resource attributes like resource type and resource name.
  138. //
  139. // To get the whole view of the attributes used in IAM
  140. // condition evaluation, the user must also look into
  141. // `AuditLog.request_metadata.request_attributes`.
  142. google.rpc.context.AttributeContext.Resource resource_attributes = 5;
  143. }
  144. // Metadata about the request.
  145. message RequestMetadata {
  146. // The IP address of the caller.
  147. // For caller from internet, this will be public IPv4 or IPv6 address.
  148. // For caller from a Compute Engine VM with external IP address, this
  149. // will be the VM's external IP address. For caller from a Compute
  150. // Engine VM without external IP address, if the VM is in the same
  151. // organization (or project) as the accessed resource, `caller_ip` will
  152. // be the VM's internal IPv4 address, otherwise the `caller_ip` will be
  153. // redacted to "gce-internal-ip".
  154. // See https://cloud.google.com/compute/docs/vpc/ for more information.
  155. string caller_ip = 1;
  156. // The user agent of the caller.
  157. // This information is not authenticated and should be treated accordingly.
  158. // For example:
  159. //
  160. // + `google-api-python-client/1.4.0`:
  161. // The request was made by the Google API client for Python.
  162. // + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`:
  163. // The request was made by the Google Cloud SDK CLI (gcloud).
  164. // + `AppEngine-Google; (+http://code.google.com/appengine; appid:
  165. // s~my-project`:
  166. // The request was made from the `my-project` App Engine app.
  167. string caller_supplied_user_agent = 2;
  168. // The network of the caller.
  169. // Set only if the network host project is part of the same GCP organization
  170. // (or project) as the accessed resource.
  171. // See https://cloud.google.com/compute/docs/vpc/ for more information.
  172. // This is a scheme-less URI full resource name. For example:
  173. //
  174. // "//compute.googleapis.com/projects/PROJECT_ID/global/networks/NETWORK_ID"
  175. string caller_network = 3;
  176. // Request attributes used in IAM condition evaluation. This field contains
  177. // request attributes like request time and access levels associated with
  178. // the request.
  179. //
  180. //
  181. // To get the whole view of the attributes used in IAM
  182. // condition evaluation, the user must also look into
  183. // `AuditLog.authentication_info.resource_attributes`.
  184. google.rpc.context.AttributeContext.Request request_attributes = 7;
  185. // The destination of a network activity, such as accepting a TCP connection.
  186. // In a multi hop network activity, the destination represents the receiver of
  187. // the last hop. Only two fields are used in this message, Peer.port and
  188. // Peer.ip. These fields are optionally populated by those services utilizing
  189. // the IAM condition feature.
  190. google.rpc.context.AttributeContext.Peer destination_attributes = 8;
  191. }
  192. // Location information about a resource.
  193. message ResourceLocation {
  194. // The locations of a resource after the execution of the operation.
  195. // Requests to create or delete a location based resource must populate
  196. // the 'current_locations' field and not the 'original_locations' field.
  197. // For example:
  198. //
  199. // "europe-west1-a"
  200. // "us-east1"
  201. // "nam3"
  202. repeated string current_locations = 1;
  203. // The locations of a resource prior to the execution of the operation.
  204. // Requests that mutate the resource's location must populate both the
  205. // 'original_locations' as well as the 'current_locations' fields.
  206. // For example:
  207. //
  208. // "europe-west1-a"
  209. // "us-east1"
  210. // "nam3"
  211. repeated string original_locations = 2;
  212. }
  213. // Identity delegation history of an authenticated service account.
  214. message ServiceAccountDelegationInfo {
  215. // First party identity principal.
  216. message FirstPartyPrincipal {
  217. // The email address of a Google account.
  218. string principal_email = 1;
  219. // Metadata about the service that uses the service account.
  220. google.protobuf.Struct service_metadata = 2;
  221. }
  222. // Third party identity principal.
  223. message ThirdPartyPrincipal {
  224. // Metadata about third party identity.
  225. google.protobuf.Struct third_party_claims = 1;
  226. }
  227. // A string representing the principal_subject associated with the identity.
  228. // For most identities, the format will be
  229. // `principal://iam.googleapis.com/{identity pool name}/subject/{subject)`
  230. // except for some GKE identities (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD)
  231. // that are still in the legacy format `serviceAccount:{identity pool
  232. // name}[{subject}]`
  233. string principal_subject = 3;
  234. // Entity that creates credentials for service account and assumes its
  235. // identity for authentication.
  236. oneof Authority {
  237. // First party (Google) identity as the real authority.
  238. FirstPartyPrincipal first_party_principal = 1;
  239. // Third party identity as the real authority.
  240. ThirdPartyPrincipal third_party_principal = 2;
  241. }
  242. }