Skip to content

Added check for destinations

Hitesh Raghuvanshi requested to merge 413624-check-destination into master

What does this MR do and why?

Adds check whether the given destinationId for destroy and update is valid or not, if not then raise error.

How to set up and validate locally

  1. Enable feature flag in rails console by running ::Feature.enabled?(:ff_external_audit_events).
  2. Login as instance admin user on http://127.0.0.1:3000/.
  3. Go to http://127.0.0.1:3000/-/graphql-explorer
  4. List all the instance level external audit event destinations by running following query in the explorer.
query {
  instanceExternalAuditEventDestinations {
    nodes {
      id
      destinationUrl
      verificationToken      
    }
  }
}
  1. Run the following mutation in the explorer to destroy non existent destination and use a id such as it is not present in the destinations recieved in step 4. (I am adding id as 555, pretty huge number for that, for which it is likely it would be present in that list.)
mutation {
  instanceExternalAuditEventDestinationDestroy(input: { id: "gid://gitlab/AuditEvents::InstanceExternalAuditEventDestination/555"}) {
    errors
  }
}
  1. The output should be an error with message "Please provide a valid destinationId."
  2. Run the following mutation in the explorer to update a non destination, similar to step 5, I am using id 555 assuming it would be non-existent.
mutation {
  instanceExternalAuditEventDestinationUpdate(input: { id: "gid://gitlab/AuditEvents::InstanceExternalAuditEventDestination/555",destinationUrl: "https://www.example200.com"}) {
    errors
    instanceExternalAuditEventDestination {
      destinationUrl
      id
      verificationToken
    }
  }
}
  1. The output will again contain error with message "Please provide a valid destinationId."

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 #413624 (closed)

Edited by Hitesh Raghuvanshi

Merge request reports