Skip to content

Fix DastProfile Update mutation

What does this MR do and why?

This MR fix the DastProfile Update mutation to delete the tags when tagList is argument is an empty list.

This issue was discussed here.

Screenshots or screen recordings

Remove DastProfile tags

Screenshot_2023-01-27_at_5.57.03_PM

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Create a new DastProfile with tags

  1. Go to /-/graphql-explorer
  2. Get a dastScannerProfile, and dastSiteProfiles ids
  3. Type a query like
mutation dastProfileCreate($input: DastProfileCreateInput!) {
  dastProfileCreate(input: $input) {
    dastProfile {
      id
      editPath
      tagList
    }
    pipelineUrl
    errors
  }
}

with a Query Variable like:

{
  "input": {
    "fullPath": "root/apiscantest",
    "name": "Test TagList",
    "dastSiteProfileId": "gid://gitlab/DastSiteProfile/16",
    "dastScannerProfileId": "gid://gitlab/DastScannerProfile/6",
    "tagList": ["ruby", "dast"]
  }
}
  1. Check the result
{
  "data": {
    "dastProfileCreate": {
      "dastProfile": {
        "id": "gid://gitlab/Dast::Profile/8",
        "editPath": "/root/apiscantest/-/on_demand_scans/8/edit",
        "tagList": [
          "dast",
          "ruby"
        ]
      },
      "pipelineUrl": null,
      "errors": []
    }
  }
}

Update the tags of a DastProfile

  1. Go to /-/graphql-explorer
  2. Type a query like
mutation dastProfileUpdate($input: DastProfileUpdateInput!) {
  dastProfileUpdate(input: $input) {
    errors
    dastProfile {
      tagList
    }
  }
}
{
  "input": {
    "id": "gid://gitlab/Dast::Profile/8",
    "name": "Test TagList",
    "tagList": []
  }
}
  1. Check the result
{
  "data": {
    "dastProfileUpdate": {
      "errors": [],
      "dastProfile": {
        "tagList": []
      }
    }
  }
}

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 Drew Blessing

Merge request reports

Loading