Hi, @coobr01.
I think the {}
you’re seeing are types that your query hasn’t asked for. You can use __typename
to see what they are.
For example, if
... on VulnerabilityDetailList {
type: __typename
name
fieldName
items {
__typename
}
}
gives me
"details": [
{
"type": "VulnerabilityDetailList",
"name": "URLs",
"fieldName": "urls",
"items": [
{
"__typename": "VulnerabilityDetailUrl"
},
{
"__typename": "VulnerabilityDetailUrl"
},
{
"__typename": "VulnerabilityDetailUrl"
},
{
"__typename": "VulnerabilityDetailUrl"
}
]
},
It tells me that I need a ... on VulnerabilityDetailUrl
to expand the values.
So once I rewrite the query to:
... on VulnerabilityDetailList {
type: __typename
name
fieldName
items {
__typename
... on VulnerabilityDetailUrl {
description
fieldName
href
name
text
}
}
}
I get to see the {}
values:
"details": [
{
"type": "VulnerabilityDetailList",
"name": "URLs",
"fieldName": "urls",
"items": [
{
"__typename": "VulnerabilityDetailUrl",
"description": null,
"fieldName": null,
"href": "http://34.136.183.135/._darcs",
"name": null,
"text": null
},
{
"__typename": "VulnerabilityDetailUrl",
"description": null,
"fieldName": null,
"href": "http://34.136.183.135/.bzr",
"name": null,
"text": null
},
{
"__typename": "VulnerabilityDetailUrl",
"description": null,
"fieldName": null,
"href": "http://34.136.183.135/.hg",
"name": null,
"text": null
},
{
"__typename": "VulnerabilityDetailUrl",
"description": null,
"fieldName": null,
"href": "http://34.136.183.135/BitKeeper",
"name": null,
"text": null
}
]
},
The full example below should get you started.
I’m not an expert, and I had to stumble across vulnerability_detail.fragment.graphql
to see how to write a query using details
.
{
group(fullPath: "gitlab-examples") {
id
name
vulnerabilities(state:[DETECTED,CONFIRMED], reportType:DAST, hasResolution:false) {
nodes{
project {
id
path
}
id
title
details {
... on VulnerabilityDetailUrl {
type: __typename
name
href
}
... on VulnerabilityDetailDiff {
type: __typename
name
before
after
}
... on VulnerabilityDetailCode {
type: __typename
name
value
}
... on VulnerabilityDetailFileLocation {
type: __typename
name
fileName
lineStart
lineEnd
}
... on VulnerabilityDetailModuleLocation {
type: __typename
name
moduleName
offset
}
... on VulnerabilityDetailCommit {
type: __typename
name
value
}
... on VulnerabilityDetailText {
type: __typename
name
value
}
... on VulnerabilityDetailMarkdown {
type: __typename
name
value
}
... on VulnerabilityDetailBoolean {
type: __typename
name
value
}
... on VulnerabilityDetailInt {
type: __typename
name
value
}
... on VulnerabilityDetailNamedList {
type: __typename
name
items {
name
fieldName
}
}
... on VulnerabilityDetailList {
type: __typename
name
}
... on VulnerabilityDetailTable {
type: __typename
name
}
}
}
}
}
}
Results:
{
"data": {
"group": {
"id": "gid://gitlab/Group/349181",
"name": "GitLab-examples",
"vulnerabilities": {
"nodes": [
{
"project": {
"id": "gid://gitlab/Project/40966370",
"path": "simple-notes-demo"
},
"id": "gid://gitlab/Vulnerability/63667310",
"title": "Hidden File Found",
"details": [
{
"type": "VulnerabilityDetailList",
"name": "URLs"
},
{
"type": "VulnerabilityDetailText",
"name": "Discovered at",
"value": "2024-03-19T17:22:18.585"
}
]
},