Commit e50df6b6 authored by Sean McGivern's avatar Sean McGivern

Merge branch '230380_expose_detected_at_information_on_graphql_api' into 'master'

Expose `detectedAt` information for vulnerabilities on GraphQL

See merge request gitlab-org/gitlab!41000
parents 4871220a cf914288
...@@ -17410,6 +17410,11 @@ type Vulnerability { ...@@ -17410,6 +17410,11 @@ type Vulnerability {
""" """
description: String description: String
"""
Timestamp of when the vulnerability was first detected
"""
detectedAt: Time!
""" """
GraphQL ID of the vulnerability GraphQL ID of the vulnerability
""" """
......
...@@ -51106,6 +51106,24 @@ ...@@ -51106,6 +51106,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "detectedAt",
"description": "Timestamp of when the vulnerability was first detected",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Time",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "id", "name": "id",
"description": "GraphQL ID of the vulnerability", "description": "GraphQL ID of the vulnerability",
...@@ -2580,6 +2580,7 @@ Represents a vulnerability. ...@@ -2580,6 +2580,7 @@ Represents a vulnerability.
| Name | Type | Description | | Name | Type | Description |
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `description` | String | Description of the vulnerability | | `description` | String | Description of the vulnerability |
| `detectedAt` | Time! | Timestamp of when the vulnerability was first detected |
| `id` | ID! | GraphQL ID of the vulnerability | | `id` | ID! | GraphQL ID of the vulnerability |
| `identifiers` | VulnerabilityIdentifier! => Array | Identifiers of the vulnerability. | | `identifiers` | VulnerabilityIdentifier! => Array | Identifiers of the vulnerability. |
| `location` | VulnerabilityLocation | Location metadata for the vulnerability. Its fields depend on the type of security scan that found the vulnerability | | `location` | VulnerabilityLocation | Location metadata for the vulnerability. Its fields depend on the type of security scan that found the vulnerability |
......
...@@ -66,5 +66,9 @@ module Types ...@@ -66,5 +66,9 @@ module Types
description: 'The project on which the vulnerability was found', description: 'The project on which the vulnerability was found',
authorize: :read_project, authorize: :read_project,
resolve: -> (obj, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, obj.project_id).find } resolve: -> (obj, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, obj.project_id).find }
field :detected_at, Types::TimeType, null: false,
description: 'Timestamp of when the vulnerability was first detected',
method: :created_at
end end
end end
---
title: Introduce `detectedAt` field for VulnerabilityType on GraphQL API
merge_request: 41000
author:
type: added
...@@ -6,9 +6,24 @@ RSpec.describe GitlabSchema.types['Vulnerability'] do ...@@ -6,9 +6,24 @@ RSpec.describe GitlabSchema.types['Vulnerability'] do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:vulnerability) { create(:vulnerability, project: project) } let_it_be(:vulnerability) { create(:vulnerability, project: project) }
let_it_be(:fields) do
let(:fields) do %i[userPermissions
%i[userPermissions id title description user_notes_count state severity report_type resolved_on_default_branch vulnerability_path location scanner primary_identifier identifiers project issueLinks] id
title
description
user_notes_count
state
severity
report_type
resolved_on_default_branch
vulnerability_path
location
scanner
primary_identifier
identifiers
project
issueLinks
detected_at]
end end
before do before do
......
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