Commit a5d11593 authored by Jonathan Schafer's avatar Jonathan Schafer

Vulnerabilities query use GlobalID for scannerID

parent 9d6730da
......@@ -8,7 +8,7 @@ query instance(
$severity: [VulnerabilitySeverity!]
$reportType: [VulnerabilityReportType!]
$scanner: [String!]
$scannerId: [Int!]
$scannerId: [ID!]
$state: [VulnerabilityState!]
$sort: VulnerabilitySort
$hasIssues: Boolean
......
......@@ -26,7 +26,7 @@ module Resolvers
required: false,
description: 'Filter vulnerabilities by VulnerabilityScanner.externalId.'
argument :scanner_id, [GraphQL::INT_TYPE],
argument :scanner_id, [::Types::GlobalIDType[::Vulnerabilities::Scanner]],
required: false,
description: 'Filter vulnerabilities by scanner ID.'
......@@ -46,6 +46,8 @@ module Resolvers
def resolve(**args)
return Vulnerability.none unless vulnerable
args[:scanner_id] = resolve_gids(args[:scanner_id], ::Vulnerabilities::Scanner) if args[:scanner_id]
vulnerabilities(args)
.with_findings_scanner_and_identifiers
.with_created_issue_links_and_issues
......@@ -53,6 +55,12 @@ module Resolvers
private
def resolve_gids(gids, gid_class)
gids.map do |gid|
Types::GlobalIDType[gid_class].coerce_isolated_input(gid).model_id
end
end
def vulnerabilities(params)
Security::VulnerabilitiesFinder.new(vulnerable, params).execute
end
......
---
title: Change vulnerabilities GraphQL query to use GlobalID for scanner IDs
merge_request: 59305
author:
type: changed
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