Commit b744251e authored by Craig Smith's avatar Craig Smith Committed by Peter Leitzen

Add nil scanned resources csv path

Add scannedResourcesCsvPath to
securityReportSummary graphQL endpoint.
The value is nil to allow frontend to move forward
The full path will be added in a later MR
parent 4ba5d833
...@@ -11799,6 +11799,11 @@ type SecurityReportSummarySection { ...@@ -11799,6 +11799,11 @@ type SecurityReportSummarySection {
""" """
scannedResourcesCount: Int scannedResourcesCount: Int
"""
Path to download all the scanned resources in CSV format
"""
scannedResourcesCsvPath: String
""" """
Total number of vulnerabilities Total number of vulnerabilities
""" """
......
...@@ -34498,6 +34498,20 @@ ...@@ -34498,6 +34498,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "scannedResourcesCsvPath",
"description": "Path to download all the scanned resources in CSV format",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "vulnerabilitiesCount", "name": "vulnerabilitiesCount",
"description": "Total number of vulnerabilities", "description": "Total number of vulnerabilities",
...@@ -1701,6 +1701,7 @@ Represents a section of a summary of a security report ...@@ -1701,6 +1701,7 @@ Represents a section of a summary of a security report
| Name | Type | Description | | Name | Type | Description |
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `scannedResourcesCount` | Int | Total number of scanned resources | | `scannedResourcesCount` | Int | Total number of scanned resources |
| `scannedResourcesCsvPath` | String | Path to download all the scanned resources in CSV format |
| `vulnerabilitiesCount` | Int | Total number of vulnerabilities | | `vulnerabilitiesCount` | Int | Total number of vulnerabilities |
## SentryDetailedError ## SentryDetailedError
......
...@@ -9,5 +9,6 @@ module Types ...@@ -9,5 +9,6 @@ module Types
field :vulnerabilities_count, GraphQL::INT_TYPE, null: true, description: 'Total number of vulnerabilities' field :vulnerabilities_count, GraphQL::INT_TYPE, null: true, description: 'Total number of vulnerabilities'
field :scanned_resources_count, GraphQL::INT_TYPE, null: true, description: 'Total number of scanned resources' field :scanned_resources_count, GraphQL::INT_TYPE, null: true, description: 'Total number of scanned resources'
field :scanned_resources, ::Types::ScannedResourceType.connection_type, null: true, description: 'A list of the first 20 scanned resources' field :scanned_resources, ::Types::ScannedResourceType.connection_type, null: true, description: 'A list of the first 20 scanned resources'
field :scanned_resources_csv_path, GraphQL::STRING_TYPE, null: true, description: 'Path to download all the scanned resources in CSV format'
end end
end end
...@@ -30,6 +30,8 @@ module Security ...@@ -30,6 +30,8 @@ module Security
response[:scanned_resources_count] = scanned_resources_counts[report_type.to_s] response[:scanned_resources_count] = scanned_resources_counts[report_type.to_s]
when :scanned_resources when :scanned_resources
response[:scanned_resources] = scanned_resources[report_type.to_s] response[:scanned_resources] = scanned_resources[report_type.to_s]
when :scanned_resources_csv_path
nil
end end
end end
end end
......
---
title: Add NULL value scannedResourcesCsvUrl to securityReportSummary
merge_request: 35949
author:
type: added
...@@ -63,4 +63,8 @@ RSpec.describe 'Query.project(fullPath).pipeline(iid).securityReportSummary' do ...@@ -63,4 +63,8 @@ RSpec.describe 'Query.project(fullPath).pipeline(iid).securityReportSummary' do
expect(dast_scanned_resources.length).to eq(20) expect(dast_scanned_resources.length).to eq(20)
end end
it 'returns nil for the scannedResourcesCsvPath' do
expect(security_report_summary.dig('dast', 'scannedResourcesCsvPath')).to be_nil
end
end end
...@@ -73,7 +73,7 @@ RSpec.describe Security::ReportSummaryService, '#execute' do ...@@ -73,7 +73,7 @@ RSpec.describe Security::ReportSummaryService, '#execute' do
context 'All fields are requested' do context 'All fields are requested' do
let(:selection_information) do let(:selection_information) do
{ {
dast: [:scanned_resources_count, :vulnerabilities_count, :scanned_resources], dast: [:scanned_resources_count, :vulnerabilities_count, :scanned_resources, :scanned_resources_csv_path],
sast: [:scanned_resources_count, :vulnerabilities_count], sast: [:scanned_resources_count, :vulnerabilities_count],
container_scanning: [:scanned_resources_count, :vulnerabilities_count], container_scanning: [:scanned_resources_count, :vulnerabilities_count],
dependency_scanning: [:scanned_resources_count, :vulnerabilities_count] dependency_scanning: [:scanned_resources_count, :vulnerabilities_count]
...@@ -102,6 +102,10 @@ RSpec.describe Security::ReportSummaryService, '#execute' do ...@@ -102,6 +102,10 @@ RSpec.describe Security::ReportSummaryService, '#execute' do
expect(result[:dast][:scanned_resources].length).to eq(20) expect(result[:dast][:scanned_resources].length).to eq(20)
end end
it 'returns the scanned_resources_csv_path as nil' do
expect(result[:dast][:scanned_resources_csv_path]).to be_nil
end
context 'When no security scans ran' do context 'When no security scans ran' do
let(:pipeline) { create(:ci_pipeline, :success) } let(:pipeline) { create(:ci_pipeline, :success) }
......
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