Commit 371fca38 authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Expose `detectedAt` information for vulnerabilities on GraphQL

This new information directly maps to `created_at` attributes of
vulnerabilities.
parent efd14c49
......@@ -17325,6 +17325,11 @@ type Vulnerability {
"""
description: String
"""
Timestamp of when the vulnerability was first detected
"""
detectedAt: Time!
"""
GraphQL ID of the vulnerability
"""
......
......@@ -50987,6 +50987,24 @@
"isDeprecated": false,
"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",
"description": "GraphQL ID of the vulnerability",
......@@ -2580,6 +2580,7 @@ Represents a vulnerability.
| Name | Type | Description |
| --- | ---- | ---------- |
| `description` | String | Description of the vulnerability |
| `detectedAt` | Time! | Timestamp of when the vulnerability was first detected |
| `id` | ID! | GraphQL ID 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 |
......
......@@ -66,5 +66,9 @@ module Types
description: 'The project on which the vulnerability was found',
authorize: :read_project,
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
......@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['Vulnerability'] do
let_it_be(:vulnerability) { create(:vulnerability, project: project) }
let(:fields) do
%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]
%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 detected_at]
end
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