Skip to content

Fix issue adding schedule to an existing dast profile

What does this MR do and why?

Describe in detail what your merge request does and why.

Fix the error 500 when adding a schedule to an existing DAST profile.

Screenshots or screen recordings

Screen_Shot_2021-11-25_at_1.34.41_PM

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. create a new DAST::Profile without an schedule
user = User.first # root user
project = Project.first # find project with dast enabled
profile = Dast::Profile.find_by(project: project.id)

dast_profile = ::Dast::Profile.create!(
  project: project,
  name: 'n21a2aaaaa',
  description: 'adad',
  branch_name: project.default_branch_or_main,
  dast_site_profile: profile.dast_site_profile,
  dast_scanner_profile: profile.dast_scanner_profile
)
  1. Add the schedule using GraphiQL Explorer
mutation dastProfileUpdate($input: DastProfileUpdateInput!) {
  dastProfileUpdate(input: $input) {
    dastProfile {
      editPath
    },
    pipelineUrl
    errors
  }
}
{
  "input": {
    "dastScannerProfileId": "gid://gitlab/DastScannerProfile/15",
    "dastSiteProfileId": "gid://gitlab/DastSiteProfile/15",
    "id": "gid://gitlab/Dast::Profile/112",
    "name": "A4.122",
    "runAfterUpdate": true,
    "dastProfileSchedule": {
      "startsAt": "Thu, 12 Aug 2021 06:48:50.845382000 UTC +00:00",
      "active": true,
      "timezone": "America/New_York",
      "cadence": {
        "duration": 1,
        "unit": "DAY"
      }
    }
  }
}

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 Marcos Rocha

Merge request reports

Loading