lib/pwn/plugins/defect_dojo.rb in pwn-0.5.76 vs lib/pwn/plugins/defect_dojo.rb in pwn-0.5.77
- old
+ new
@@ -430,10 +430,12 @@
# Necessary to upload file to remote host
http_body[:multipart] = true
http_body[:file] = File.new(opts[:file].to_s.strip.chomp.scrub, 'rb') if File.exist?(opts[:file].to_s.strip.chomp.scrub)
+ http_body[:test_title] = opts[:test_title]
+
# Ok lets determine the resource_uri for the lead username
lead_username = opts[:lead_username].to_s.strip.chomp.scrub
user_list = self.user_list(dd_obj: dd_obj)
if api_version == 'v1'
@@ -466,9 +468,22 @@
# Defaults to Time.now.strftime('%Y-%m-%d')
opts[:scan_date] ? (http_body[:scan_date] = opts[:scan_date]) : (http_body[:scan_date] = Time.now.strftime('%Y-%m-%d'))
# Defaults to false
opts[:verified] ? (http_body[:verified] = true) : (http_body[:verified] = false)
+
+ valid_group_by = %w[
+ component_name
+ component_name+compoent_version
+ file_path
+ finding_title
+ ]
+
+ group_by = opts[:group_by]
+ # If group_by is set, ensure we have a valid group_by value
+ raise "ERROR: Invalid group_by value: #{group_by}. Options are 'product' or 'engagement'" unless valid_group_by.include?(group_by) || group_by.nil?
+
+ http_body[:group_by] = group_by if group_by
opts[:create_finding_groups] ? (http_body[:create_finding_groups_for_all_findings] = true) : (http_body[:create_finding_groups_for_all_findings] = false)
opts[:close_old_findings_product_scope] ? (http_body[:close_old_findings_product_scope] = true) : (http_body[:close_old_findings_product_scope] = false)