Use site profiles in on-demand DAST scans

- Added the ability to use existing site profiles when running new
on-demand DAST scans
- Updated/added specs
parent d429e468
...@@ -29,6 +29,14 @@ export default { ...@@ -29,6 +29,14 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
profilesLibraryPath: {
type: String,
required: true,
},
newSiteProfilePath: {
type: String,
required: true,
},
}, },
data() { data() {
return { return {
...@@ -46,6 +54,8 @@ export default { ...@@ -46,6 +54,8 @@ export default {
:help-page-path="helpPagePath" :help-page-path="helpPagePath"
:project-path="projectPath" :project-path="projectPath"
:default-branch="defaultBranch" :default-branch="defaultBranch"
:profiles-library-path="profilesLibraryPath"
:new-site-profile-path="newSiteProfilePath"
@cancel="showForm = false" @cancel="showForm = false"
/> />
<on-demand-scans-form-old <on-demand-scans-form-old
......
mutation dastOnDemandScanCreate($fullPath: ID!, $dastSiteProfileId: DastSiteProfileID!) {
dastOnDemandScanCreate(input: { fullPath: $fullPath, dastSiteProfileId: $dastSiteProfileId }) {
pipelineUrl
errors
}
}
...@@ -5,13 +5,19 @@ import OnDemandScansApp from './components/on_demand_scans_app.vue'; ...@@ -5,13 +5,19 @@ import OnDemandScansApp from './components/on_demand_scans_app.vue';
export default () => { export default () => {
const el = document.querySelector('#js-on-demand-scans-app'); const el = document.querySelector('#js-on-demand-scans-app');
if (!el) { if (!el) {
return; return null;
} }
const { helpPagePath, emptyStateSvgPath, projectPath, defaultBranch } = el.dataset; const {
helpPagePath,
emptyStateSvgPath,
projectPath,
defaultBranch,
profilesLibraryPath,
newSiteProfilePath,
} = el.dataset;
// eslint-disable-next-line no-new return new Vue({
new Vue({
el, el,
apolloProvider, apolloProvider,
render(h) { render(h) {
...@@ -21,6 +27,8 @@ export default () => { ...@@ -21,6 +27,8 @@ export default () => {
emptyStateSvgPath, emptyStateSvgPath,
projectPath, projectPath,
defaultBranch, defaultBranch,
profilesLibraryPath,
newSiteProfilePath,
}, },
}); });
}, },
......
...@@ -6,7 +6,9 @@ module Projects::OnDemandScansHelper ...@@ -6,7 +6,9 @@ module Projects::OnDemandScansHelper
'help-page-path' => help_page_path('user/application_security/dast/index', anchor: 'on-demand-scans'), 'help-page-path' => help_page_path('user/application_security/dast/index', anchor: 'on-demand-scans'),
'empty-state-svg-path' => image_path('illustrations/empty-state/ondemand-scan-empty.svg'), 'empty-state-svg-path' => image_path('illustrations/empty-state/ondemand-scan-empty.svg'),
'default-branch' => project.default_branch, 'default-branch' => project.default_branch,
'project-path' => project.path_with_namespace 'project-path' => project.path_with_namespace,
'profiles-library-path': project_profiles_path(project),
'new-site-profile-path': new_project_dast_site_profile_path(project)
} }
end end
end end
...@@ -10,6 +10,8 @@ const helpPagePath = `${TEST_HOST}/application_security/dast/index#on-demand-sca ...@@ -10,6 +10,8 @@ const helpPagePath = `${TEST_HOST}/application_security/dast/index#on-demand-sca
const projectPath = 'group/project'; const projectPath = 'group/project';
const defaultBranch = 'master'; const defaultBranch = 'master';
const emptyStateSvgPath = `${TEST_HOST}/assets/illustrations/alert-management-empty-state.svg`; const emptyStateSvgPath = `${TEST_HOST}/assets/illustrations/alert-management-empty-state.svg`;
const profilesLibraryPath = `${TEST_HOST}/${projectPath}/-/on_demand_scans/profiles`;
const newSiteProfilePath = `${TEST_HOST}/${projectPath}/-/on_demand_scans/profiles`;
describe('OnDemandScansApp', () => { describe('OnDemandScansApp', () => {
let wrapper; let wrapper;
...@@ -32,6 +34,8 @@ describe('OnDemandScansApp', () => { ...@@ -32,6 +34,8 @@ describe('OnDemandScansApp', () => {
projectPath, projectPath,
defaultBranch, defaultBranch,
emptyStateSvgPath, emptyStateSvgPath,
profilesLibraryPath,
newSiteProfilePath,
}, },
}, },
options, options,
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlForm } from '@gitlab/ui'; import { GlForm } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import OnDemandScansForm from 'ee/on_demand_scans/components/on_demand_scans_form.vue'; import OnDemandScansForm from 'ee/on_demand_scans/components/on_demand_scans_form_old.vue';
import runDastScanMutation from 'ee/on_demand_scans/graphql/run_dast_scan.mutation.graphql'; import runDastScanMutation from 'ee/on_demand_scans/graphql/run_dast_scan.mutation.graphql';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
......
...@@ -11,7 +11,9 @@ RSpec.describe Projects::OnDemandScansHelper do ...@@ -11,7 +11,9 @@ RSpec.describe Projects::OnDemandScansHelper do
'help-page-path' => help_page_path('user/application_security/dast/index', anchor: 'on-demand-scans'), 'help-page-path' => help_page_path('user/application_security/dast/index', anchor: 'on-demand-scans'),
'empty-state-svg-path' => match_asset_path('/assets/illustrations/empty-state/ondemand-scan-empty.svg'), 'empty-state-svg-path' => match_asset_path('/assets/illustrations/empty-state/ondemand-scan-empty.svg'),
'default-branch' => project.default_branch, 'default-branch' => project.default_branch,
'project-path' => project.path_with_namespace 'project-path' => project.path_with_namespace,
'profiles-library-path': project_profiles_path(project),
'new-site-profile-path': new_project_dast_site_profile_path(project)
) )
end end
end end
......
...@@ -16655,21 +16655,33 @@ msgstr "" ...@@ -16655,21 +16655,33 @@ msgstr ""
msgid "OnDemandScans|Attached branch is where the scan job runs." msgid "OnDemandScans|Attached branch is where the scan job runs."
msgstr "" msgstr ""
msgid "OnDemandScans|Could not fetch site profiles. Please try again."
msgstr ""
msgid "OnDemandScans|Could not run the scan. Please try again." msgid "OnDemandScans|Could not run the scan. Please try again."
msgstr "" msgstr ""
msgid "OnDemandScans|Could not run the scan: %{backendErrorMessage}" msgid "OnDemandScans|Could not run the scan: %{backendErrorMessage}"
msgstr "" msgstr ""
msgid "OnDemandScans|Create a new site profile"
msgstr ""
msgid "OnDemandScans|Create new DAST scan" msgid "OnDemandScans|Create new DAST scan"
msgstr "" msgstr ""
msgid "OnDemandScans|DAST will scan the target URL and any discovered sub URLs." msgid "OnDemandScans|DAST will scan the target URL and any discovered sub URLs."
msgstr "" msgstr ""
msgid "OnDemandScans|Manage profiles"
msgstr ""
msgid "OnDemandScans|New on-demand DAST scan" msgid "OnDemandScans|New on-demand DAST scan"
msgstr "" msgstr ""
msgid "OnDemandScans|No profile yet. In order to create a new scan, you need to have at least one completed site profile."
msgstr ""
msgid "OnDemandScans|On-demand Scans" msgid "OnDemandScans|On-demand Scans"
msgstr "" msgstr ""
...@@ -16679,24 +16691,42 @@ msgstr "" ...@@ -16679,24 +16691,42 @@ msgstr ""
msgid "OnDemandScans|Only a passive scan can be performed on demand." msgid "OnDemandScans|Only a passive scan can be performed on demand."
msgstr "" msgstr ""
msgid "OnDemandScans|Passive"
msgstr ""
msgid "OnDemandScans|Passive DAST Scan" msgid "OnDemandScans|Passive DAST Scan"
msgstr "" msgstr ""
msgid "OnDemandScans|Please enter a valid URL format, ex: http://www.example.com/home" msgid "OnDemandScans|Please enter a valid URL format, ex: http://www.example.com/home"
msgstr "" msgstr ""
msgid "OnDemandScans|Run scan"
msgstr ""
msgid "OnDemandScans|Run this scan" msgid "OnDemandScans|Run this scan"
msgstr "" msgstr ""
msgid "OnDemandScans|Scan mode" msgid "OnDemandScans|Scan mode"
msgstr "" msgstr ""
msgid "OnDemandScans|Scanner settings"
msgstr ""
msgid "OnDemandScans|Schedule or run scans immediately against target sites. Currently available on-demand scan type: DAST. %{helpLinkStart}More information%{helpLinkEnd}" msgid "OnDemandScans|Schedule or run scans immediately against target sites. Currently available on-demand scan type: DAST. %{helpLinkStart}More information%{helpLinkEnd}"
msgstr "" msgstr ""
msgid "OnDemandScans|Select one of the existing profiles"
msgstr ""
msgid "OnDemandScans|Site profiles"
msgstr ""
msgid "OnDemandScans|Target URL" msgid "OnDemandScans|Target URL"
msgstr "" msgstr ""
msgid "OnDemandScans|Use existing site profile"
msgstr ""
msgid "Once a project is permanently deleted it %{strongStart}cannot be recovered%{strongEnd}. Permanently deleting this project will %{strongStart}immediately delete%{strongEnd} its respositories and %{strongStart}all related resources%{strongEnd} including issues, merge requests etc." msgid "Once a project is permanently deleted it %{strongStart}cannot be recovered%{strongEnd}. Permanently deleting this project will %{strongStart}immediately delete%{strongEnd} its respositories and %{strongStart}all related resources%{strongEnd} including issues, merge requests etc."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment