Skip to content

Model validation and listing of active attribute for streaming headers

Hitesh Raghuvanshi requested to merge 367509-activate-headers-1 into master

What does this MR do and why?

This MR does following:

  1. Adds a model validation for streaming headers to ensure that the value of newly added active attribute is boolean only.
  2. While streaming audit events to destinations, only active headers will be used.
  3. Now active attribute can also be listed while querying streaming headers.

In followup MRs, ability to update active attribute will be added.

Note: By default the value of active attribute is true.

How to set up and validate locally

  1. For model validation, create a new streaming destination and a header for it by following steps in https://docs.gitlab.com/ee/administration/audit_event_streaming/#http-destinations.
  2. Open rails console, and try to update the active attribute for the created header with value nil, you will get an error.
  3. For active headers being streamed, you can update the value of active attribute for a header from rails console to be false, and then try to trigger an event which will stream an event to this destination, you will observe inactive headers are not streamed.
  4. For listing active attribute in graphql, while listing down the details of an external destination as mentioned in https://docs.gitlab.com/ee/administration/audit_event_streaming/graphql_api.html#list-streaming-destinations, you can run the graphql query as following to incorporate active attribute in headers
query {
  group(fullPath: "my-group") {
    id
    externalAuditEventDestinations {
      nodes {
        destinationUrl
        verificationToken
        id
        name
        headers {
          nodes {
            key
            value
            id
            active
          }
        }
        eventTypeFilters
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #367509 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports