Skip to content
Snippets Groups Projects

Move tags from dast_scanner_profiles to dast_profile

Merged Marcos Rocha requested to merge mc_rocha-add-tag-list-to-dast-profiles-type-345430 into master
All threads resolved!

What does this MR do and why?

In the Merge Request !104909 (merged) we added the table dast_profiles_tags and in the MR !107521 (merged) we update the GraphQL api and the related mutations and services. However we realized that runner tags should be linked to the Dast::Profile instead of the DastScannerProfile.

This Merge Request adds the table dast_profiles_tags and updates the related mutations and services.

The dast_scanner_profiles_tags table will be removed in a follow-up MR.

Migrations

Add dast_profiles_tags

up

main: == 20230106184809 CreateDastProfilesTags: migrating ===========================
main: -- create_table(:dast_profiles_tags)
main:    -> 0.0099s
main: == 20230106184809 CreateDastProfilesTags: migrated (0.0103s) ==================

down

main: == 20230106184809 CreateDastProfilesTags: reverting ===========================
main: -- drop_table(:dast_profiles_tags)
main:    -> 0.0029s
main: == 20230106184809 CreateDastProfilesTags: reverted (0.0051s) ==================

This MR is part of issue #345430 (closed)

Screenshots or screen recordings

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

Create a new DastProfile with tags.

Screenshot_2023-01-09_at_4.52.25_PM

Update the tags of a DastScannerProfile.

Screenshot_2023-01-09_at_4.52.11_PM

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": ["rails", "on-demand"]
  }
}
  1. Check the result
{
  "data": {
    "dastProfileUpdate": {
      "errors": [],
      "dastProfile": {
        "tagList": [
          "on-demand",
          "rails"
        ]
      }
    }
  }
}

Run an on-demand scan

  1. Go to /-/on_demand_scans#/saved
  2. Find the DastProfile scan created in the previous step.
  3. Click in Run scan.
  4. Check the job created. It should have the DastProfile tags.

Screenshot_2023-01-09_at_4.58.31_PM

  1. Wait for the job to start. It should run on the runner with all DastProfile tags.

Screenshot_2023-01-09_at_5.38.23_PM

  1. Check the runner Screenshot_2022-12-21_at_5.03.39_PM

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
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Philip Cunningham
  • Philip Cunningham
  • Philip Cunningham
  • Philip Cunningham removed review request for @philipcunningham

    removed review request for @philipcunningham

  • Marcos Rocha added 1 commit

    added 1 commit

    Compare with previous version

  • Marcos Rocha added 51 commits

    added 51 commits

    Compare with previous version

  • Marcos Rocha added 554 commits

    added 554 commits

    Compare with previous version

  • Marcos Rocha added 1 commit

    added 1 commit

    • d50546bd - Fix spec error message check

    Compare with previous version

  • requested review from @philipcunningham

  • Marcos Rocha added 190 commits

    added 190 commits

    Compare with previous version

  • Philip Cunningham removed review request for @philipcunningham

    removed review request for @philipcunningham

  • Marcos Rocha added 108 commits

    added 108 commits

    Compare with previous version

  • Marcos Rocha added 13 commits

    added 13 commits

    Compare with previous version

  • requested review from @philipcunningham

  • Philip Cunningham approved this merge request

    approved this merge request

  • :wave: @philipcunningham, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.

    For more info, please refer to the following links:

  • Philip Cunningham requested review from @stanhu and removed review request for @philipcunningham

    requested review from @stanhu and removed review request for @philipcunningham

  • Stan Hu
  • Stan Hu
  • Marcos Rocha added 653 commits

    added 653 commits

    • 2fa9c438...edb1ddd8 - 645 commits from branch master
    • 91969bbb - Add dast_profiles_tags table
    • 08f38c4e - Address MR comments
    • a6d7af1f - Fix spec attribute alignment
    • 2d360075 - Fix spec error message check
    • 292b7309 - Deprecate tag_list on DastScannerProfile
    • 5766a714 - Deprecate tag_list on DastScannerProfile
    • 1c00562b - Deprecate tag_list on DastScannerProfile
    • b09e73b8 - Update tag_list description and resolve signature

    Compare with previous version

  • Stan Hu changed milestone to %15.9

    changed milestone to %15.9

  • Stan Hu resolved all threads

    resolved all threads

  • Stan Hu approved this merge request

    approved this merge request

  • merged

  • @stanhu, did you forget to run a pipeline before you merged this work? Based on our code review process, if the latest pipeline was created more than 6 hours ago, and finished more than 2 hours ago, you should:

    1. Ensure the merge request is not in Draft status.
    2. Start a pipeline (especially important for Community contribution merge requests).
    3. Set the merge request to merge when pipeline succeeds.

    This is a guideline, not a rule. Please consider replying to this comment for transparency.

    This message was generated automatically. You're welcome to improve it.

  • Stan Hu mentioned in commit 852a7d39

    mentioned in commit 852a7d39

  • mentioned in issue #345430 (closed)

  • Artur Fedorov mentioned in merge request !103634 (merged)

    mentioned in merge request !103634 (merged)

  • added workflowstaging label and removed workflowcanary label

  • Ben Prescott_ mentioned in issue #505982

    mentioned in issue #505982

  • Please register or sign in to reply
    Loading