Pass Dast::Profile in profile schedule worker
What does this MR do and why?
this merge request passes along the parent dast_profile
rather than individual child profiles when running a scheduled dast
scan. this was necessary in order to track which profile triggered the scan because the frontend uses this for presentational purposes.
Screenshots or screen recordings
Before
you can see that there is no dast_profile
associated.
After
after scheduling a dast_profile
to run, i can see it's now associated.
[29] pry(main)> pipeline = Ci::Pipeline.find(101)
Ci::Pipeline Load (0.4ms) SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."id" = 101 LIMIT 1 /*application:console,db_config_name:main,line:(pry):29:in `__pry__'*/
=> #<Ci::Pipeline:0x00007f867d754c88
id: 101,
ref: "master",
sha: "fae711a9882f6c1795bd37f336891fe70c752a11",
before_sha: "0000000000000000000000000000000000000000",
created_at: Thu, 21 Oct 2021 00:24:20.019278000 UTC +00:00,
updated_at: Thu, 21 Oct 2021 00:24:52.220506000 UTC +00:00,
tag: false,
yaml_errors: nil,
committed_at: nil,
project_id: 9,
status: "success",
started_at: Thu, 21 Oct 2021 00:24:31.504162000 UTC +00:00,
finished_at: Thu, 21 Oct 2021 00:24:52.186541000 UTC +00:00,
duration: 22,
user_id: 1,
lock_version: 3,
auto_canceled_by_id: nil,
pipeline_schedule_id: nil,
source: "ondemand_dast_scan",
config_source: "parameter_source",
protected: true,
failure_reason: nil,
iid: 58,
merge_request_id: nil,
source_sha: nil,
target_sha: nil,
external_pull_request_id: nil,
ci_ref_id: 1,
locked: "artifacts_locked">
[30] pry(main)> pipeline.dast_profile
(0.4ms) SELECT "dast_profiles_pipelines"."dast_profile_id" FROM "dast_profiles_pipelines" WHERE "dast_profiles_pipelines"."ci_pipeline_id" = 101 /*application:console,db_config_name:main,line:(pry):30:in `__pry__'*/
Dast::Profile Load (0.3ms) SELECT "dast_profiles".* FROM "dast_profiles" WHERE "dast_profiles"."id" = 142 ORDER BY "dast_profiles"."id" ASC LIMIT 1 /*application:console,db_config_name:main,line:(pry):30:in `__pry__'*/
=> #<Dast::Profile:0x00007f867ebaff70 id: 142, project_id: 9, dast_site_profile_id: 121, dast_scanner_profile_id: 143, created_at: Fri, 08 Oct 2021 05:45:25.864207000 UTC +00:00, updated_at: Tue, 19 Oct 2021 04:18:39.089998000 UTC +00:00, name: "Really cool name 3", description: "[FILTERED]", branch_name: "master">
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Philip Cunningham