# DQL behind the ThirdParty Vulnerability app

**URL:** <https://community.dynatrace.com/t/dql-behind-the-thirdparty-vulnerability-app/46119>\
**Category:** DQL\
**Tags:** dql, application-security\
**Created:** [June 14, 2024, 8:56am UTC](https://community.dynatrace.com/t/dql-behind-the-thirdparty-vulnerability-app/46119 "2024-06-14T08:56:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANLTH](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@ANLTH](https://community.dynatrace.com/u/ANLTH)\
**Post date:** [June 14, 2024, 8:56am UTC](https://community.dynatrace.com/t/dql-behind-the-thirdparty-vulnerability-app/46119/1 "2024-06-14T08:56:57Z")

</div>

I am woriking on understanding how we shall use ownership in Dynatrace in relation to Applicaiton Security.

I have added the Owner tag to some processes that has vulnerabilites, and I am able to filter by the tag and get the relevant vulnerabilites - the app is not able to derive the DQL behind the request and open it with a Notebook or Dashboard.

How does the DQL behind the request look like?

 ![ANLTH_0-1718355215364.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/c/7c153bbcea2b50fb444ec2c7f43703f08683711e.png)

---

<div class="post-metadata">

**Author:** ![MaciejNeumann](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MaciejNeumann](https://community.dynatrace.com/u/MaciejNeumann)\
**Post date:** [November 21, 2024, 10:43am UTC](https://community.dynatrace.com/t/dql-behind-the-thirdparty-vulnerability-app/46119/2 "2024-11-21T10:43:16Z")

</div>

Hello&nbsp;[@ANLTH](https://community.dynatrace.com/user/63301),

Here is an answer I got from the Application Security team:

“Unfortunately we are not writing ownership info to vulnerability state reports, the underlying data for Vulnerability dashboards in 3rd gen. The workaround is to 1) query affected entities 2) add a lookup query to fetch ownership info for the affected PGs. Here’s an example:”

```javascript
fetch events
| filter dt.system.bucket=="default_security_events"
| filter event.provider=="Dynatrace"
| filter event.type=="VULNERABILITY_STATE_REPORT_EVENT"
| filter event.level=="ENTITY"
| sort timestamp, direction:"descending"
| summarize {
	vulnerability.resolution.status = takeFirst(vulnerability.resolution.status),
	affected_entity.management_zones.names = takeFirst(affected_entity.management_zones.names),
	affected_entity.vulnerable_component.name = takeFirst(affected_entity.vulnerable_component.name),
	affected_entity.name = takeFirst(affected_entity.name),
	vulnerability.parent.mute.status = takeFirst(vulnerability.parent.mute.status),
	vulnerability.parent.resolution.status = takeFirst(vulnerability.parent.resolution.status),
	vulnerability.stack = takeFirst(vulnerability.stack),
	vulnerability.parent.risk.level = takeFirst(vulnerability.parent.risk.level)
},
 by: {
	vulnerability.id,
	affected_entity.id
}
| filter vulnerability.parent.resolution.status == "OPEN" AND vulnerability.parent.mute.status == "NOT_MUTED"
| filter in(vulnerability.stack,{"CODE","CODE_LIBRARY","SOFTWARE","CONTAINER_ORCHESTRATION"})
| filter in(vulnerability.parent.risk.level,{"CRITICAL","HIGH","MEDIUM","LOW","NONE"})

| filter vulnerability.resolution.status=="OPEN"

//add ownership information
| lookup [
fetch dt.entity.process_group
| fieldsAdd tags
| parse toString(tags), "LD ('owner:'|'owner\\\\:') (SPACE)? LD:Team ('\"')"
| fieldsRemove tags
], sourceField:affected_entity.id, lookupField:id, fields:{Team}
// end of adding ownership info​

```
