audit_log.proto 14 KB

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