You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could benefit from an overview of the status of a workspace, I wrote a custom SQL with the info I care the most about, it's probably trivial to modify to show more details
SELECTw.nameAS Wname, s.nameAS Sname,COUNT(*) AS New, COALESCE(AlreadySeen,0) AS AlreadySeen, sr.timeFROM workspaces w
INNER JOIN findings f ON (f.workspace_id=w.id)
INNER JOIN scans s ON (f.scan_id=s.id )
INNER JOIN runs sr ON (sr.scan_id=s.id )
LEFT OUTER JOIN
(
-- This table contains all the findings marked new which have a comment or are linked to an issue-- And is used only to count the findingsSELECTw1.nameAS wsn,s1.nameAS scann, COUNT(*) AS AlreadySeen FROM findings f1
INNER JOIN workspaces w1 ON (f1.workspace_id=w1.id)
INNER JOIN scans s1 ON (f1.scan_id=s1.id )
INNER JOIN runs sr1 ON (sr1.scan_id=s1.id)
LEFT OUTER JOIN issues2findings i2f ON (i2f.finding_id=f1.id)
WHERE-- Either there is a comment or the finding is linked to an issue
(f1.remarkIS NOT NULLORi2f.issue_idIS NOT NULL)
ANDf1.status=1ANDsr1.timeIN (SELECTMAX(time) FROM runs WHERE scan_id =s1.id)
GROUP BYw1.name,s1.name
) AS alreadys
ON (w.name=alreadys.wsnANDs.name=alreadys.scann)
WHEREf.status=1ANDsr.timeIN (SELECTMAX(time) FROM runs WHERE scan_id =s.id)
GROUP BYw.name,s.nameUNION-- Workspaces without new findingsSELECTw.nameAS wsn,s.name,0AS New,0As AlreadySeen, sr.timeFROM workspaces w
INNER JOIN scans s ON (w.id=s.workspace_id)
INNER JOIN runs sr ON (s.id=sr.scan_id)
WHEREsr.timeIN (SELECTMAX(time) FROM runs WHERE scan_id =s.id)
-- The scan must not contain any finding marked as new (aka results shown in the first query)ANDs.name NOT IN (
SELECTs.nameFROM scans s
INNER JOIN runs sr ON (sr.scan_id=s.id)
INNER JOIN findings f ON (f.scan_id=s.id)
INNER JOIN workspaces w1 ON (w1.id=s.workspace_id)
-- Only for the last runWHEREsr.timeIN (SELECTMAX(time) FROM runs WHERE scan_id =s.id)
-- Per workspaceANDw1.name=w.nameANDf.status=1
)
ORDER BY1,5DESC```
The text was updated successfully, but these errors were encountered:
I could benefit from an overview of the status of a workspace, I wrote a custom SQL with the info I care the most about, it's probably trivial to modify to show more details
The text was updated successfully, but these errors were encountered: