Skip to content

Add streaming audit event for work items deletion

Alexandru Croitor requested to merge audit_evevnt_for_work_items_deletion into master

What does this MR do and why?

This MR add a streamed audit event for deleting an issue, epic, merge request or work item.

re #370487 (closed)

Screenshots or screen recordings

This is a sample request body sent out when deleting a task:

Click to see json
{
  "id": 1662108106,
  "author_id": 1,
  "entity_id": 1,
  "entity_type": "Project",
  "details": {
    "author_name": "Administrator",
    "author_class": "User",
    "target_id": 470,
    "target_type": "WorkItem",
    "target_details": {
      "title": "Task 3",
      "iid": 35,
      "id": 470,
      "type": "Task"
    },
    "custom_message": "Removed Task(Task 3 with IID: 35 and ID: 470)",
    "ip_address": "127.0.0.1",
    "entity_path": "gitlab-org/gitlab-test"
  },
  "ip_address": "127.0.0.1",
  "author_name": "Administrator",
  "entity_path": "gitlab-org/gitlab-test",
  "target_details": "{\"title\"=>\"Task 3\", \"iid\"=>35, \"id\"=>470, \"type\"=>\"Task\"}",
  "created_at": "2022-09-02T08:41:46.636Z",
  "target_type": "WorkItem",
  "target_id": 470,
  "event_type": "delete_work_item"
}

How to set up and validate locally

  1. Add a streaming destination. I followed the documentation we have on that https://docs.gitlab.com/ee/administration/audit_event_streaming.html#add-a-new-streaming-destination
  2. I used https://requestbin.com/ to setup an endpoint.
  3. Delete an issue, epic, mr
  4. Check the endpoing setup at point (2) for the request details.

MR acceptance checklist

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

Edited by Alexandru Croitor

Merge request reports