Bitbucket Audit - Include source branch information in BranchCreatedEvent

XMLWordPrintable

    • 1
    • 1
    • CtB - Improve Existing

      Due to audit purposes, there is a requirement to retrieve branch creation information from Bitbucket.

      Currently, the audit information will show:

      • Who created the new branch
      • The repository it belongs to
      • When it was created

      {
        "affectedObjects": [
          {
            "id": "5",
            "name": "CRP",
            "type": "PROJECT"
          },
          {
            "id": "232",
            "name": "testrepo01",
            "type": "REPOSITORY"
          }
        ],
        "auditType": {
          "action": "Branch created",
          "actionI18nKey": "bitbucket.service.branch.audit.action.branchcreated",
          "area": "END_USER_ACTIVITY",
          "category": "Repositories",
          "categoryI18nKey": "bitbucket.service.audit.category.repositories",
          "level": "ADVANCED"
        },
        "author": {
          "id": "2",
          "name": "Admin",
          "type": "NORMAL"
        },
        "changedValues": [],
        "extraAttributes": [
          {
            "name": "Load balancer/proxy IP address",
            "nameI18nKey": "atlassian.audit.event.attribute.forwarder",
            "value": "10.255.0.19"
          },
          {
            "name": "Branch",
            "nameI18nKey": "bitbucket.service.branch.audit.attribute.branchdeleted.branch",
            "value": "B3"
          }
        ],
        "method": "Browser",
        "node": "abba256d-74ed-41d8-bf80-d70a9b1782cd",
        "source": "10.255.0.1",
        "system": "https://server:8443",
        "timestamp": {
          "epochSecond": 1725386657,
          "nano": 225000000
        },
        "version": "1.0"
      }
      

      The atlassian-bitbucket.log will show the commit the new branch was created from:

      2024-09-03 18:04:17,230 DEBUG [AtlassianEvent::thread-1] Admin @1HYYCQ4x1084x52866x0 1q791bh 10.255.0.1,10.255.0.19 "POST /rest/branch-utils/latest/projects/CRP/repos/testrepo01/branches HTTP/1.1" c.a.b.internal.tag.DefaultTagService CRP/testrepo01[232]: Ignoring 1 ref changes; no tags were changed
      refs/heads/B3: 0000000000000000000000000000000000000000 -> 9ba21874ac2cbe26ce3b832052d67b9c7c15f966 (ADD) [BRANCH]
      

      Since the UI allows us to select the source branch, it would be great to store this information in the audit records.

      Thanks!

            Assignee:
            Unassigned
            Reporter:
            Ulisses Azevedo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: