Skip to content

Add passive and active profiles 347384

What does this MR do and why?

Describe in detail what your merge request does and why.

This Merge Request updates the ee/app/models/dast_scanner_profile.rb to use the DAST_API_PROFILE variable as described here.

This Merge Request is related to issue #347384 (closed).

Screenshots or screen recordings

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

How to set up and validate locally

  1. Open the rails console
rails c
  1. Create a new DastScannerProfile with scan_type active
dsp = DastScannerProfile.create(name: "#{FFaker::Product.product_name.truncate(192)} #{SecureRandom.hex(4)} - #{rand(100)}", scan_type: 'active', project: Project.last)
  1. Check that DAST_API_PROFILE ci variable has the value Quick-Active
dsp.ci_variables

@errors=nil,
 @variables=
  [#<Gitlab::Ci::Variables::Collection::Item:0x00007fa111c311d0 @variable={:key=>"DAST_USE_AJAX_SPIDER", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>,
   #<Gitlab::Ci::Variables::Collection::Item:0x00007fa111c310b8 @variable={:key=>"DAST_DEBUG", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>,
   #<Gitlab::Ci::Variables::Collection::Item:0x00007fa111c30fa0 @variable={:key=>"DAST_API_PROFILE", :value=>"Quick-Active", :public=>true, :file=>false, :masked=>false, :raw=>false}>],
 @variables_by_key=
  {"DAST_USE_AJAX_SPIDER"=>[#<Gitlab::Ci::Variables::Collection::Item:0x00007fa111c311d0 @variable={:key=>"DAST_USE_AJAX_SPIDER", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>],
   "DAST_DEBUG"=>[#<Gitlab::Ci::Variables::Collection::Item:0x00007fa111c310b8 @variable={:key=>"DAST_DEBUG", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>],
   "DAST_API_PROFILE"=>[#<Gitlab::Ci::Variables::Collection::Item:0x00007fa111c30fa0 @variable={:key=>"DAST_API_PROFILE", :value=>"Quick-Active", :public=>true, :file=>false, :masked=>false, :raw=>false}>]}>
  1. Create a new DastScannerProfile with scan_type passive
dsp = DastScannerProfile.create(name: "#{FFaker::Product.product_name.truncate(192)} #{SecureRandom.hex(4)} - #{rand(100)}", scan_type: 'passive', project: Project.last)
  1. Check that DAST_API_PROFILE ci variable has the value Quick
dsp.ci_variables

 dsp.ci_variables
=> #<Gitlab::Ci::Variables::Collection:0x00007fa112a3db70
 @errors=nil,
 @variables=
  [#<Gitlab::Ci::Variables::Collection::Item:0x00007fa112a3da08 @variable={:key=>"DAST_USE_AJAX_SPIDER", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>,
   #<Gitlab::Ci::Variables::Collection::Item:0x00007fa112a3d918 @variable={:key=>"DAST_DEBUG", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>,
   #<Gitlab::Ci::Variables::Collection::Item:0x00007fa112a3d800 @variable={:key=>"DAST_API_PROFILE", :value=>"Quick", :public=>true, :file=>false, :masked=>false, :raw=>false}>],
 @variables_by_key=
  {"DAST_USE_AJAX_SPIDER"=>[#<Gitlab::Ci::Variables::Collection::Item:0x00007fa112a3da08 @variable={:key=>"DAST_USE_AJAX_SPIDER", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>],
   "DAST_DEBUG"=>[#<Gitlab::Ci::Variables::Collection::Item:0x00007fa112a3d918 @variable={:key=>"DAST_DEBUG", :value=>"false", :public=>true, :file=>false, :masked=>false, :raw=>false}>],
   "DAST_API_PROFILE"=>[#<Gitlab::Ci::Variables::Collection::Item:0x00007fa112a3d800 @variable={:key=>"DAST_API_PROFILE", :value=>"Quick", :public=>true, :file=>false, :masked=>false, :raw=>false}>]}>

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

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