Asset Group Risk Score -- API vs. SQL


I am trying to generate the summary for dynamic sites, that looks like/asset/group/listing.jsp. Specifically:
site name, # of assets, # of vulnerabilities, risk score.

The python API, get_asset_groups returns the information exactly as what is shown in the UI.

However, the below SQL does not. The riskscore, number of assets and vulnerabilities are all smaller.

SELECT, fag.assets, fag.vulnerabilities,ROUND(fag.riskscore) as riskscore
FROM fact_asset_group fag
JOIN dim_asset_group dag USING (asset_group_id)

Anyone know why?

Hey @garora, I double checked with the team on this one and got some feedback that this could be related to the usage of the fact_asset_group table in the query. This table updates based on scans that occur, so for instance, if an asset has been added to the console through dynamic discovery and then added to the asset group, but has never been scanned, then it won’t show in this table. That could impact the output of the query and result in the numbers being somewhat off, like you said.