Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAL data proto fields don't match actual CAL data #43

Closed
grant opened this issue Aug 10, 2020 · 5 comments
Closed

CAL data proto fields don't match actual CAL data #43

grant opened this issue Aug 10, 2020 · 5 comments
Assignees
Labels
api: eventarc Issues related to the googleapis/google-cloudevents API.

Comments

@grant
Copy link
Contributor

grant commented Aug 10, 2020

Expected Behavior

I'd expect all fields that are present in in the CAL data seen for Events are present in our proto definitions. We can't have missing fields, or else our libraries will be missing fields from the JSON payload.

For example, these fields seen from Events are not found:

  • @type
  • authorizationInfo.resourceAttributes
  • requestMetadata.callerNetwork
  • requestMetadata.requestAttributes
  • requestMetadata.destinationAttributes
  • resourceLocation

Actual Behavior

There are many fields that are seen with CAL data, but not present here.

Here's an example of the event payload:

{
  "protoPayload": {
    "serviceName": "storage.googleapis.com",
    "methodName": "storage.buckets.update",
    "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
    "resourceName": "projects/_/buckets/test-bucket",
    "status": {},
    "authenticationInfo": {
      "principalEmail": "example@gmail.com"
    },
    "requestMetadata": {
      "callerIp": "192.168.0.1",
      "callerSuppliedUserAgent": "apitools Python/3.7.7 gsutil/4.51 (linux) analytics/disabled  google-cloud-sdk/297.0.0,gzip(gfe)",
      "callerNetwork": "//compute.googleapis.com/projects/google.com:cloudtop-prod/global/networks/__unknown__",
      "requestAttributes": {
        "time": "2020-06-18T19:05:26.688510991Z",
        "auth": {}
      },
      "destinationAttributes": {}
    },
    "authorizationInfo": [
      {
        "resource": "projects/_/buckets/test-bucket",
        "permission": "storage.buckets.update",
        "granted": true,
        "resourceAttributes": {}
      }
    ],
    "resourceLocation": {
      "currentLocations": [
        "us-central1"
      ]
    }
  }
}

Here's an example from the Knative GCP repo:

https://github.com/google/knative-gcp/blob/master/docs/examples/cloudauditlogssource/README.md


I'm not sure if this is because these protos are not complete after copying them over or if this is intentional.

CC @jskeet

@product-auto-label product-auto-label bot added the api: events Issues related to the googleapis/google-cloudevents API. label Aug 10, 2020
@jskeet
Copy link
Collaborator

jskeet commented Aug 11, 2020

Okay, a few separate issues here:

  • Why are we seeing protoPayload? I'd expect the data of the CloudEvent to just be the AuditLog message. We should talk to the event teams about that.
  • The @type attribute is because this is basically a google.protobuf.Any converted into JSON. I'm not sure it's a good idea for that to be in the event at all - it's going to cause confusion - but it may be hard to remove. Again, let's talk to the event teams.
  • The other "extra" fields are more easily explained: our schema hasn't yet taken this commit into account. I've been aware of this, but focusing on other event types. I'll create a PR for that today.

jskeet added a commit to jskeet/google-cloudevents that referenced this issue Aug 11, 2020
This reflects the changes in the [googleapis
commit](googleapis/googleapis@40292fc).

Fixes most of the discrepancies noted in googleapis#43.
@grant
Copy link
Contributor Author

grant commented Aug 11, 2020

Okay, a few separate issues here:

  • Why are we seeing protoPayload? I'd expect the data of the CloudEvent to just be the AuditLog message. We should talk to the event teams about that.
  • The @type attribute is because this is basically a google.protobuf.Any converted into JSON. I'm not sure it's a good idea for that to be in the event at all - it's going to cause confusion - but it may be hard to remove. Again, let's talk to the event teams.
  • The other "extra" fields are more easily explained: our schema hasn't yet taken this commit into account. I've been aware of this, but focusing on other event types. I'll create a PR for that today.

All in all, let's be sure that the payloads seen by users exactly match the payloads fields here. I'd assume the protos would EXACTLY match the payload seen for some specific CloudEvent#type (which includes the version). This is to be used by our client libraries.

@grant
Copy link
Contributor Author

grant commented Aug 11, 2020

Part of this might be an artifact of logging this information. Will need to figure out the differences with logging there.

@jskeet
Copy link
Collaborator

jskeet commented Aug 11, 2020

This is now being discussed internally - we'll post an update here when there's more resolution. (That's probably better than trying to maintain multiple lines of communication.)

jskeet added a commit that referenced this issue Aug 11, 2020
This reflects the changes in the [googleapis
commit](googleapis/googleapis@40292fc).

Fixes most of the discrepancies noted in #43.
@product-auto-label product-auto-label bot added api: eventarc Issues related to the googleapis/google-cloudevents API. and removed api: events Issues related to the googleapis/google-cloudevents API. labels Sep 22, 2020
@grant
Copy link
Contributor Author

grant commented Oct 29, 2020

I'm seeing all of these fields in the proto and jsonschema, so closing. If CAL events v2 will unwrap the protoPayload field, that's a separate issue (version).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: eventarc Issues related to the googleapis/google-cloudevents API.
Projects
None yet
Development

No branches or pull requests

2 participants